Alpha Video Training
Results 1 to 2 of 2

Thread: PDF damaged on download

  1. #1
    Member
    Real Name
    Tom Dietrich
    Join Date
    May 2009
    Location
    Pewaukee, WI
    Posts
    40

    Default PDF damaged on download

    I am downloading a PDF that was produced offline. When I download it or view it, I get the message: "There was an error opening your document. The file is damaged and could not be repaired." When I tested it locally, It opened without any problem; the problem only happens from the web server.

    The odd thing is when I open the file in a text editor, there is additional info that shouldn't be there. The correct header looks like this:
    Code:
    %PDF-1.4
    %âãÏÓ
    215 0 obj
    <</Linearized 1/L 1458936/O 217/E 707280/N 4/T 1454515/H [ 4116 733]>>
    endobj
              
    xref
    215 191
    0000000016 00000 n
    0000004849 00000 n
    The bad header looks like this:
    Code:
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    %PDF-1.4
    %âãÏÓ
    215 0 obj
    <</Linearized 1/L 1458936/O 217/E 707280/N 4/T 1454515/H [ 4116 733]>>
    endobj
              
    xref
    215 191
    0000000016 00000 n
    0000004849 00000 n
    In addition, my source code for the download page is at the end of the pdf.

    I'm not sure that it matters but the file is located outside of the webroot. There are no security issues, so putting it inside is not a problem if anyone thinks that will help. Here is the code that I am using.

    Code:
    if eval_valid("submit0") 
    	response.mime_type = resolve_mime_type("PDF")
    	response.add_header("Content-disposition: attachment; filename=" + urlFile)
    	?file.to_blob(urlFilepath)	
    end if
    I did play around with the mime_type and tried "application/pdf" and got worse results (5k file); I'm not sure that has anything to do with it but I thought I'd throw it out there.

    Any insight would be greatly appreciated.

    Thanks,
    Tom

  2. #2
    Member
    Real Name
    Tom Dietrich
    Join Date
    May 2009
    Location
    Pewaukee, WI
    Posts
    40

    Default Re: PDF damaged on download

    I found the answer here: http://msgboard.alphasoftware.com/al...217#post427217

    The key is this info in reply 19:
    Quote Originally Posted by Steve Wood View Post
    OK, I worked with Lenny on this offline. It works now, as Lenny described. They key is that the A5W page must only have the xbasic code, none of the HTML tags that are normally part of a A5W page. The final code is below and that is ALL that should be in the A5W page source.

Similar Threads

  1. Can't delete - damaged table?
    By Stephen Williams in forum Alpha Five Version 7
    Replies: 2
    Last Post: 01-23-2009, 11:17 AM
  2. I can't create tempreport.pdf when I want generate a PDF report...
    By JJdeveloper in forum Application Server Version 8
    Replies: 5
    Last Post: 06-27-2007, 12:24 AM
  3. damaged a_action.dll
    By Ginette Hughes in forum Alpha Five Version 5
    Replies: 2
    Last Post: 08-22-2003, 07:01 AM
  4. damaged a_action.dll
    By Ginette Hughes in forum Alpha Five Version 5
    Replies: 0
    Last Post: 12-30-2002, 07:58 AM
  5. Damaged floppy
    By Nigel Grant in forum Alpha Four Version 6 and Prior
    Replies: 1
    Last Post: 05-10-2001, 05:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •