Home Devices

Error when opening PDF attachment

Hi,

I generate a PDF with attachments, in this case a PDF.
...
Report.PDFSettings.Attachments.Add( lFile );
...

With acrobat reader, it shows an error when I try to open the attached pdf.
"Error opening document, problem reading document"
With Firefox, the attachment is displayed correctly.

This occurs when the pdf generated with the attachment has been made on a server without a pdf reader.
I have two servers, one with a default PDF reader (Acrobat) and the other without a default reader.

When I open the generated pdfs with a text editor i have observed these labels

Server with a default PDF reader:
<< /Type /EmbeddedFile
/Subtype /application#2Fpdf

Server without a default PDF reader:
<< /Type /EmbeddedFile
/Subtype /application/octet-stream

If I change the subtype to /application#2Fpdf it works.

Does it depend on the default pdf reader?
Is there any way to change it?

Thanks.

Comments

  • This question is being handled/researched via email. A solution or comment will be posted here when it is available.
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • ReportBuilder uses the Windows API routine FindMimeFromData to determine the MIME type of a file. This routine primarily uses the windows registry to return the correct MIME type. In some cases (such as a server where no PDF type is registered) this routine will not find a valid MIME type and the default value "application\octet-stream" is used.

    To avoid this scenario, MIME sniffing has been enabled by default for the API call which will look at the file contents and try to determine a valid type. If this fails, a hard-coded list has been added to ReportBuilder which includes numerous commonly used MIME types as a fall-back option.

    These enhancements will be added for the next release of ReportBuilder.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Nico,

    Is there any option to get a patch and not wait for next release?

    Thanks
  • Hi Jesus,

    A patch with MIME sniffing enabled for the API call has already been sent. The other changes require interface changes so will need to wait for the next release.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.