Xojo Conferences

DynaPDF Manual - Page 526

Previous Page 525   Index   Next Page 527

Function Reference
Page 526 of 767
int main(int argc, char* argv[])
char outFile[] = "cout.pdf";
void* pdf = pdfNewPDF(); // Create a new PDF instance
if (!pdf) return -2; // Out of memory?
pdfSetOnErrorProc(pdf, NULL, (void*)PDFError);
// The output file is opened later...
pdfCreateNewPDF(pdf, NULL);
// No need to convert pages to templates. See SetImportFlags() for
// further information.
pdfSetImportFlags(pdf, ifImportAll | ifImportAsPage);
pdfSetImportFlags2(pdf, if2UseProxy); // Reduce the memory usage
pdfOpenImportFile(pdf, "test.pdf", ptOwner, NULL);
pdfImportPDFFile(pdf, 1, 1.0, 1.0);
// No fatal error occurred?
if (pdfHaveOpenDoc(pdf))
// OK, now we can open the output file. The function can be called
// in a while statement, e.g. to display a file open dialog.
if (!pdfOpenOutputFile(pdf, outFile))
return -1;
// We encrypt the file, low-resolution printing should be allowed
if (pdfCloseFileEx(pdf,NULL,"%3Fc&",kl128bit, rsDenyAll & ~rsPrint))
printf("PDF file \"%s\" successfully created!\n", outFile);
ShellExecute(0, "open", outFile, NULL, NULL, SW_SHOWMAXIMIZED);
pdfDeletePDF(pdf); // Do not forget to delete the PDF instance
return 0;
LBOOL pdfOpenOutputFile(
const PPDF* IPDF,
// Instance pointer
const char* OutPDF) // Output file name
The function opens the output file into which the PDF file should be written. The PDF file must be
created in memory if this function should be used. This is the case if the output file name is set to
NULL or to an empty string in CreateNewPDF().

Previous topic: OpenOutputFile

Next topic: OpenTag