PDF Empty after print
Hello,
I'am having problems creating an PDF file.
when i'm running this code:
TextEditor.LoadFromFile(RTFTemplate);
TextEditor.MailMerge := True;
Report.TextFileName := RTFOutputFile;
Report.DeviceType := dtDoc;
Report.Print;
I'll get an doc-file which shows an merged RTF file, everything is fine.
When running this code:
TextEditor.LoadFromFile(RTFTemplate);
TextEditor.MailMerge := True;
Report.TextFileName := PDFOutputFile;
Report.DeviceType := dtPDF;
Report.Print;
I'll get an empty PDF file and an error after opening in Adobe Reader,
running windows 2003 x64, in Windows 7 x64 everything is Ok.
The PDF-files sizes ar 32.4KB.
The Error is: There was a problem reading this document (14)
Met vriendelijke groet,
Désirée Willemsen
I'am having problems creating an PDF file.
when i'm running this code:
TextEditor.LoadFromFile(RTFTemplate);
TextEditor.MailMerge := True;
Report.TextFileName := RTFOutputFile;
Report.DeviceType := dtDoc;
Report.Print;
I'll get an doc-file which shows an merged RTF file, everything is fine.
When running this code:
TextEditor.LoadFromFile(RTFTemplate);
TextEditor.MailMerge := True;
Report.TextFileName := PDFOutputFile;
Report.DeviceType := dtPDF;
Report.Print;
I'll get an empty PDF file and an error after opening in Adobe Reader,
running windows 2003 x64, in Windows 7 x64 everything is Ok.
The PDF-files sizes ar 32.4KB.
The Error is: There was a problem reading this document (14)
Met vriendelijke groet,
Désirée Willemsen
This discussion has been closed.
Comments
Which version of ReportBuilder and Delphi are you using? Are you able to
successfully export a report with a static Richtext component present? What
about a simple report with just a label or memo?
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I'am using Report Builder 12.02 and Delphi 2010.
I've tried an static RichText Component everything looks like normal, the
PDF was readable.
But when using this:
TextEditor.LoadFromFile(RTFTemplate);
TextEditor.MailMerge := True;
Report.TextFileName := RTFOutputFile;
Report.DeviceType := dtRTF;
Report.Print;
TextEditor.LoadFromFile(RTFOutputFile);
TextEditor.MailMerge := False;
Report.TextFileName := PDFOutputFile;
Report.DeviceType := dtPDF;
Report.Print;
This also returns an empty PDF file.
In the RTF file generated was also a strange issue. Carriage Returns are
placed in the middle of the document, the template i use doesn't contain
them. I've solved this issue by deleting some RTF. Maybe this happens also
while generating the PDF which may corrupt the file.
Can I send you the Corrupt PDF or the RTF (Template)?
Thanx
Desiree
I've found the problem.
OldDec := DecimalSeparator;
OldThousand := ThousandSeparator;
try
DecimalSeparator := ',';
ThousandSeparator := '.';
TextEditor.LoadFromFile(RTFTemplate);
TextEditor.MailMerge := True;
Report.TextFileName := PDFOutputFile;
Report.DeviceType := dtPDF;
Report.Print;
finally
ThousandSeparator := OldThousand;
DecimalSeparator := OldDec;
end;
Running this code in a Windows-Service changes some characters inside the
PDF-File which corrupt the file. I've changed floatfields to into
stringfields and formatted it by self. It works fine.
Greetz
Desiree.
Thanks for the update.
Yes, starting with RB 12, it is now necessary to change the ppFormatSettings
global property each time you alter the Delphi global FormatSettings values.
For instance...
uses
ppUtils;
begin
DecimalSeparator := ',';
ThousandSeparator := '.';
ppFormatSettings.DecimalSeparator := DecimalSeparator;
ppFormatSettings.ThousandSeparator := ThousandSeparator;
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Hi Nico,
can this be done one time at startup of the application or should this
be done each time a report is created?
Thx,
Bernaert Dominique
Since this is a global property, it only needs to be set once at startup (or
each time the Delphi FormatSettings are altered).
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Could a change in dateseparator or time format be the cause of empty
pdf-files?
Dominique
No, only changing the ThousandSeparator and DecimalSeparator will affect PDF
output however it is still recommended that you keep the ppFormatSettings in
sync with any changes you make to the FormatSettings object.
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Perhaps a sill question but how do you keep the ppFormatSettings in sync
with any changes you make to the FormatSettings object. Is it as simple as
ppFormatSettings := FormatSettings?
Regards
Tim Murfitt
Yes, this should work as well.
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Some of my customers have this problem of an empty PDF too.
They all work on Windows 7 Home Premium.
User on Vista or XP don't seem te have this problem.
Regards,
Stef
Hello Nico,
Some of my customers have this problem of an empty PDF too.
They all work on Windows 7 Home Premium.
User on Vista or XP don't seem te have this problem.
Regards,
Stef
Are you changing the FormatSettings like the others in this thread? If
so you will also need to alter the ppFormatSettings as well.
If this is not the issue, please send me a copy of one of the empty PDF
files and I'll take a look at it for you. Send the file to
support@digital-metaphors.com.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Yes, I do change the FormatSettings and now the ppFormatSettings as well.
This works fine.
I just posted my findings so you know that this issue aparently isn't related
to all operatingsystems.
Regards,
Stef
I understand now. Thank you very much for the information.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com