- Large PDF file generated.
- Report containing hyperlinks, generate big PDF document.
- When exporting a report that contains hyperlinks that start with: http or https to PDF format, from Crystal Reports, the PDF file generated is much larger than expected.
- SAP Crystal Reports 2011
- SAP Crystal Reports 2013
- SAP Crystal Reports 2016
Reproducing the Issue
- In Crystal Reports, create a report based on any data source.
- Add database fields to the Details section of the report.
- Insert a hyperlink on a database fields that starts with: ‘http://’ or ‘https’, like: ‘http://www.sap.com’
- Export the report to PDF format, and save the file locally.
- Look at the generated PDF file size.
- Open the PDF document in Adobe Reader.
- From Adobe Reader, save the open document under a different name.
- Notice the file size of the PDF document has drastically been reduced.
- Crystal Reports uses the public API supported by Adobe: 'pdfmark', to add hyperlink to the PDF document it generates.
- When saving a PDF document from Adbobe, it converts those hyperlinks to the postscript type"/TypeObjStm", but this "Type" is not part of the public standard, therefore it cannot be used by third party application, like Crystal Reports.
- The reason the file size is reduced when the PDF is saved from Adobe, it's because Adobe are using internal postscript type that are not accessible to third party software.
- Since Crystal Reports can only use public postscript to generates the PDF document, we have to use 'pdfmark' when adding hyperlink to PDF, and cannot use Adobe internal postscript. Therefore, the best that could be done to potentially minimize the space hyperlink takes, was to:
- Remove duplicate hyperlink contents;
- Remove blank, and carriage return;
- Use the abbreviated forms of key, according to the pdfmark reference (/A instead of /Annot).
But note that the above improvements does not guarantee the file size of the generated PDF document will be smaller, as it depends of the hyperlinks inserted on the report. Those enhancements were added to the following product updates and above:
- Crystal Reports 2011
- Support Pack 07 - Patch 10
- Support Pack 09 - Patch 3
- Crystal Reports 2013
- Support Pack 02 - Patch 3
- Support Pack 04 - Patch 1
To help minimize the generated PDF file size, modify the hyperlinks to not use http or https, at the beginning of the link, whenever possible:
- In Crystal Reports, open the report.
- Right click on the field that contains a hyperlink, and select "Format Field..."
- In the "Format Editor", under the tab "Hyperlink", whenever possible, remove the beginning of the hyperlink that stats with:
And replaced it with something like: 'www'
If the hyperlink was: http://www.sap.com
Then replace it by : www.sap.com
- Save the report.
Note: If the hyperlink comes from a field, or formula, it is possible to update, or create a formula to remove the start of the hyperlink that starts with http and https.
CR, PDF export , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , Bug Filed
SAP Crystal Reports 2011 ; SAP Crystal Reports 2013 ; SAP Crystal Reports 2016