I have an ASP.Net application that needs to display an image that is stored in a Filemaker Container field. My query statement looks like:
SELECT GetAs(Image, 'JPG') FROM UA_Item_Pictures WHERE "Stock Number" = 33989 AND ImageOrder = 1
According to the documentation:
The possible file types (case sensitive) you can retrieve from a container field in a FileMaker database file are:
'EMBO'
OLE container data
'PDF '
Portable Document Format
'EMF+'
Windows Enhanced Metafile Plus
'PICT'
Mac OS (does not have 512-byte file-based header)
'EPS '
Embedded PostScript
'PNGf'
Bitmap image format
'FILE'
Result of an Insert File command
'PNTG'
MacPaint
'FPix'
Flash (FPX)
'qtif'
QuickTime image file
'FORK'
Resource fork (Mac OS)
'.SGI'
Generic bitmap format
'GIFf'
Graphics Interchange Format
'snd '
Standard sound (Mac OS raw format)
'JPEG'
Photographic images
'TIFF'
Raster file format for digital images
'JP2 '
JPEG 2000
'TPIC'
Targa
'META'
Windows Metafile (enhanced)
'XMLO'
Layout objects
'METO'
Windows Metafile (original)
'8BPS'
PhotoShop (PSD)
'moov'
Old QuickTime format (Mac OS)
So with this information, my questions are:
How do I retrieve contents with multiple formats?
How do I render the BLOG into an image on the page?
Any suggestions would be much appreciated!
Thanks, but I think I found out what was going on. If I did an inner join between an image table and another table, the image wasn't being returned (or being returned properly...not sure which). As soon as I ran a query against the image table directly, images were returned.
So this did not work:
select * from biography_table b inner join image_table i on b.stocknumber = i.stocknumber
where b.stocknumber = 12345
But this does:
select * from image_table where stocknumber = 12345
This means I have to run 2 separate queries, but at least I'm seeing data!!
If you cannot predict what the file type will be, AND/OR you need to use other extensions (such as docx, xlsx, etc), then you can exclusively use 'FILE' for all of your storage and retrieval scripts.
However doing it this way means that FileMaker does not know natively how to handle and open the file. In other words, when using FileMaker you will need to manually export the contents of the field to edit/view it, instead of being able to simply double click the field and it opens the file. So either the setup is advantageous to FileMaker, or advantageous to your external application.
If you do it this way, all files in container fields will be called 'Untitled.dat' and their internal name will be '?', so you will also need to store in another field the actual file name or its extension so you can open it later.
It is because you are using JPG instead of JPEG, in fact, your question answers itself. You can read it this way
SELECT GetAs(Image, 'JPEG') ...
And then, if you are using ado.net read it this way
var bytesLength = reader.GetBytes(0, 0, null, 0, 0);
var buffer = new Byte[bytesLength];
var bytes = reader.GetBytes(0, 0, buffer, 0, (int)bytesLength);
using (var fileStream = new FileStream(String.Format("{0}.jpg", Guid.NewGuid().ToString()), FileMode.Create, FileAccess.Write)) {
fileStream.Write(buffer, 0, buffer.Length);
}
Where 0 at the beggining of the the GetBytes function is the index of the photo field.
Buy a license of SuperContainer (shameless plug alert: I'm one of the authors) and a Mac Mini to host it on. Move the files out of your container fields and into SuperContainer, and let SuperContainer render image versions of your files by tapping into OS X's CoreImage libs.
Related
Whenever I make a custom item, I am unable to drag it onto a hotbar. When I try to pick it up the icon turns to a question mark and will not stick to a hotkey.
For example, I made an exact copy of the Murloc Costume (id 33079) at id 50017 (which was a free slot on my DB). The original I can put on a hotbar. The custom one I cannot.
Here's a gif of the issue
Answer: if it's not in the client side DBC's, it will not work properly.
From ReynoldsCahoon on the AC Discord:
I just modified a DBC recently. I had to use a tool (I used Ladik's MPQ Editor) to extract the specific DBC I wanted to modify, and then I used WDBX to open the DBC and manipulate it. In WDBX you can output it in a variety of formats (like CSV or SQL) so you can modify the values any way you like, and then reimport (via CSV or SQL) the values back in.
I loosely followed the guide here: https://model-changing.net/tutorials/article/23-41-creating-your-first-mpq-patch/
I exported a DBC containing all of the Character Titles in the game. Erased all of them, and then imported a bunch of new values of my own choosing. Instead of importing that back into the MPQ I got it from, I created a new MPQ called patch-4.mpq that I placed in my client WotLK/Data/ directory, and then on the server, I placed the DBC file into the worldserver/data/dbc/ directory, replacing the original DBC.
I think this can optionally be overwritten in the database, by using the associated _dbc table to override values from the dbc files (someone correct me if this part is wrong).
I am trying to read a bulk of Adobe Indesign (indd) files and access its content through a script.
I want to check the name of drawing files present in the project and fetch that information in a flat file.
Can anybody help me with this as I am new to this technology?
If you are looking to read the bytes from the indd files, you cannot. The indd is a binary blob and no one knows what data is stored where.
If you are talking about getting list of placed files in the indd document, javascript can do that for you.
Step 1. Open the indd in indesign.
Step 2. the following script can return the path of each graphic in the doc
var grphx = app.activeDocument.allGraphics;
var i = 0;
for (i =0; i < grphx.length;++i)
{
alert(grphx[i].link.filePath);
}
Problem:
My project... printing a sequence of pages... created based on certain templates and database info...
The sequence of pages to be printed can be, in certain situations, of different sizes.
I have been trying to print to real printer, producing multiple pages
if (m_printer->newPage()) { ... }
and on a physical printer, if I try to change the page size, it either doesn't work or puts the printer in an error state.
So there is not much choice, it seems, but to make each page a separate job. Minor disadvantages - possibly on a network. Oh well.
On pdf or any type of file printing, though, it makes a huge difference, whether the sequence is contained in a single document on multiple pages, or if it creates hundreds of different documents of one page each.
So, I found this Is it possible to make a pdf with different page size in Qt?
it seems to be exactly what I need, if I print to a pdf - while for real printer I will make each page a separate job.
The only problem:
How can I tell if I am creating a pdf file, or if I am sending a job to a real printer ?
I looked in QPrinter and QPrinterInfo, I did not see anything that can help.
Pdf printing is probably enabled because of Adobe Acrobat.
I am implementing this currently in Windows.
Edit: why getting the outputFormat (Naidu's answer below) doesn't work:
qprinter.cpp:
void QPrinterPrivate::initEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer)
{
..
// Only set NativeFormat if we have a valid plugin and printer to use
if (format == QPrinter::NativeFormat) { //////// which of course has to be, we have to support any printer
ps = QPlatformPrinterSupportPlugin::get();
QPrinterInfo printerToUse = findValidPrinter(printer);
if (ps && !printerToUse.isNull()) { //////// both valid since the PDF writer is valid
outputFormat = QPrinter::NativeFormat;
printerName = printerToUse.printerName();
}
}
...
}
I would like to have something to check, other than the fact that "pdf" may be contained in the name. If needed, I am willing to use the awful DEVMODE, I just don't know what to look for.
Use the public function
QPrinter::outputFormat()
it returns an enum type enum QPrinter::OutputFormat.
And check if it is QPrinter::PdfFormat
http://doc.qt.io/qt-5/qprinter.html#OutputFormat-enum
I don't normally script in Adobe and the rabbit hole is very deep after doing some searching, so I was wondering if someone knows how I can add a watermark to an existing PDF by calling Adobe Acrobat Pro from a windows batch file. I already know about 'Actions" in Adobe as well as Javascript, but not sure how I could call one of these from a batch file. I'm open to suggestions/ideas here though if it achieves the same thing and is fairly straight forward -- even if not using Adobe.
I don't know what you exactly want but here a short vbs example, which can easy changed to a windows batch file. Good luck, Reinhard
file = "d:\Test.pdf"
'// open acrobat and set required objects
Set App = CreateObject("Acroexch.app")
app.show
Set AVDoc = CreateObject("AcroExch.AVDoc")
Set AForm = CreateObject("AFormAut.App") 'from AFormAPI
'// open the file and add a watermark based on text (using AcroJs)
If AVDoc.Open(file,"") Then
AForm.Fields.ExecuteThisJavaScript "this.addWatermarkFromText(""Confidential"", 0, font.Helv, 24, color.red);"
end if
Set AVDoc = Nothing
Set AForm = Nothing
Set APP = Nothing
I use excel through vb.net/asp.net to generate reports from a web page and then send the file down to the user. We've had some issues with Excel being super slow/inefficient/not closing (even when we keep track of the process id and try to kill it in code...). So I'm looking for some flexible alternatives. We need a replacement that can:
Allow for inidivdual cell formatting including borders (different settings on each side), background colors, font styles/coloring, etc...
Allow for cell merging
Allow for formatting (bolding in this case) of a portion of the text inside of a cell while leaving the rest of the text unchanged
Image insertion/repositioning inside a cell (not crucial)
Multiple Worksheets per Workbook
These are all the features I can think of off hand, any help or suggestiong at alternative libraries to look at would be appreciated. We are running Excel 2007 on the server but we are rolling out Office 2010 to clients so I think that might open the doors for some more supported file formats, if that helps.
After looking through the various options and performing more independent research I ended up using EPPlus, which you can get # http://epplus.codeplex.com.
Thanks for all the suggestions.
I recommend you to use the DevExpress.XtraReports from DevExpress. It is a Licensed product, but offers you a friendly toolkit for generating great and complexity reports. It is well documented and easy to use, once you define a template (REPX) you can populate it with data by assigning to each element a value as well as using [mail merge] feature which will be automatically replaced once you bind with data the report. In the core of such technology is a well OO design of classes. Once you generate the report you can export it to the most common formats: XLS, HTML, PDF, RTF...
public void GenerateReportFile(string rptFileName, string param1, int param2)
{
XtraReport report = null;
try
{
report = new XtraReport();
//-- loads the layout template (repx file)
report.LoadLayout("SomeDirectory\report_template.repx");
//-- assign data to report controls
report.FindControl("Label1", true).Text = string.Format("{0:dd/MM/yyyy}", fecha1);
report.FindControl("Label2", true).Text = string.Format("{0:dd/MM/yyyy}", fecha1);
//-- gets data from some Data Acces Layer method and assig it to the report DataSource property
DALReport dal = new DALReport();
report.DataSource = dal.GetReport1Data(ExpEmp, param1, param2);
report.DataMember = "data";
report.ExportToPdf(rptFileName, options);
}
catch { throw; }
finally { if (report != null) { report.Dispose(); } report = null; }
}
For more information refers to: http://demos.devexpress.com/XtraReportsDemos/
There is another free library for .Net iTextSharp, this library
was originally written for Java, then was translated to C# for .Net
usage. The library is mainly for PDF documents creation but some
versions also supports XLS documents creation.
GNU plot is a little bit of a pain to get to run on windows but it is a an awesome tool
It sounds like you are using a library that opens Excel and uses MS Office Excel objects to create the Excel file. Since you are using 2007 and above, you may want to consider creating the Excel file manually using a library that creates the XML (therefore, Excel doesn't open at all).
Check out ExcelLibrary.
While doing a search on this, I found this page (on StackOverflow) that provides some sample code.
Office Web Components (though dated) is free and has worked for me in the past.
If you want to spend the loot, Aspose Cells is a good way to go also.