Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

bullzip, print image file into pdf

$
0
0
Hi guys whoever using bullzip,
CREATE(pdfSettings,FALSE,TRUE);
CREATE(pdfUtil,FALSE,TRUE);

// The status file is used to check for errors and determine when the PDF is ready.
statusFileName := BaseFolder + '\status.ini';

// Set file name for output file.
pdfFileName := OutputPathAndFilename;

// Delete old output file if it already exist.
IF EXISTS(pdfFileName) THEN ERASE(pdfFileName);

// Multiple PDF printers could be installed. Let the automation know which one to control.
pdfSettings.printerName := pdfUtil.DefaultPrinterName;

// Set output file name
pdfSettings.SetValue('Output', pdfFileName);

// Make sure no dialogs are shown during conversion.
pdfSettings.SetValue('ShowSaveAs', 'never');
pdfSettings.SetValue('ShowSettings', 'never');
pdfSettings.SetValue('ShowPDF', 'no');
pdfSettings.SetValue('ShowProgress', 'no');
pdfSettings.SetValue('ShowProgressFinished', 'no');
pdfSettings.SetValue('ConfirmOverwrite', 'no');

// Set file name of status file to wait for.
pdfSettings.SetValue('StatusFile', statusFileName);

// Do not show errors in PDF user interface.
pdfSettings.SetValue('SuppressErrors', 'yes');

// Write settings to printer.
// This writes a file name runonce.ini. It is a configuration that is used
// for the next print job. The printer will delete the runonce.ini after it is read.
pdfSettings.WriteSettings(TRUE);

IF EXISTS(statusFileName) THEN ERASE(statusFileName);

// Print out the physical file via bullzip printer
pdfUtil.PrintFile(SourcePathAndFilename,pdfSettings.printerName);

IF pdfUtil.WaitForFile(statusFileName, 20000)  THEN BEGIN
  // Check status file for errors.
  IF pdfUtil.ReadIniString(statusFileName, 'Status', 'Errors', '') <> '0' THEN BEGIN
    ERROR('Error creating PDF. ' + pdfUtil.ReadIniString(statusFileName, 'Status', 'MessageText', ''));
  END;
END ELSE BEGIN
  // The timeout elapsed. Something is wrong.
  ERROR('Error creating ' + pdfFileName)
END;

CLEAR(pdfSettings);
CLEAR(pdfUtil);

If my SourcePathAndFilename is a word file (.doc / .docx), it goes well done.
If it is a image file (.jpg), it says:
qtkpebknztx3.jpg

Does anybody have idea how can image file be handled? TQ

Viewing all articles
Browse latest Browse all 10032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>