• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

PDF version 1.5 and higher (from Scanner) not able to view/download in browser

New Here ,
Feb 06, 2018 Feb 06, 2018

Copy link to clipboard

Copied

I'm developing a vb.net web application. Recently I face a problem where the PDF file with version 1.5 and higher are not able to view/download through browser. When I click the link to view the PDF file, the browser will prompt a "File Download" message box, when I choose to open the PDF file, the adobe reader display this error "There was an error opening this document. The file is damaged and could not be repaired." Even if I choose "Save" to PC then open the PDF file, it still display the same error message.

Please note that the sources for those PDF file is from scanner. If I'm using the Microsoft Word to save the document as PDF, it has no issue in viewing the PDF file no matter in what PDF version.

The code I'm using for view attachment is as below:

HTTPContext.Current.Response.ContentType = "APPLICATION/PDF"

HTTPContext.Current.Response.AppendHeader("Content-Disposition", "Attachment; Filename=XXX.pdf")

HttpContext.Current.Response.Flush()

HttpContext.Current.Response.WriteFile(System.IO.FileInfo(FILE_PATH).FullName)

HttpContext.Current.ApplicationInstance.CompleteRequest()

Is there any issue with the code? Any solution to resolve this issue?

TOPICS
General troubleshooting

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 06, 2018 Feb 06, 2018

Copy link to clipboard

Copied

Can you open the file in Adobe Acrobat?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

Yes, it can be opened as normal. But when I use the web application to view/download the PDF file, it cannot be opened.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

Compare the file which the app received with the file on the server.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

When I compare the PDF download from the application with the original file on server, the only different is the downloaded PDF file has some HTML embedded code after the original content.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

This may be the reason for the error message.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

So why some of the PDF file will included the HTML embedded code?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

LATEST

The web-server script that is serving it is doing a bad job of it...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

Sounds like an issue with your browser's PDF plugin...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

At first, I also guess whether is this issue, but when I try to scan the PDF again and try to view through the web application, it works. The PDF version I re-scan is 1.6.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

Not sure is there away for me to upload the PDF file in this forum for checking?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines