Skip navigation
Currently Being Moderated

Do you want to save changes message while close pdf

May 4, 2012 5:38 AM

hi everyone...

 

I am very new to PDF programming

basically I wrote my program in notepad and I saved it as .pdf format

but when I open it and try to close it..it showing me pop up like do you want to save changes..which is I dont want to happen...

 

is any one have idea what changes i have to do or how i make my file readonly....

 

thnks in advance...

PDF issue.png

 
Replies
  • Currently Being Moderated
    May 4, 2012 6:15 AM   in reply to jay.ant

    Jay,

     

    take a look at my comments I provided in this question yesterday:

    http://forums.adobe.com/thread/998312?tstart=0

    You are running into the same problems. PDF is a binary file format, and

    your byte offsets in the cross reference table are incorrect. Acrobat will

    repair your file for you when you load it, and because at the time you want

    to close the file, it's different than the one you have on disk (it

    contains Acrobat's fixes), the application is prompting you to save it.

    Once your byte offsets are correct, this will no longer happen.

     

    Karl Heinz Kremer

    PDF Acrobatics Without a Net

     

    khk@khk.net

    http://www.khkonsulting.com

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 7:47 AM   in reply to jay.ant

    PDF is NOT a programming language – it’s a binary file format.   That’s why you can’t write one in notepad.

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2012 4:48 PM   in reply to jay.ant

    Jay – you can’t just copy text samples from the PDF Reference.

     

    PDF is NOT a textual format – it is a binary file format and can only be written by machines (or humans willing to count bytes to fill out the xref).

     
    |
    Mark as:
  • Currently Being Moderated
    May 6, 2012 6:02 AM   in reply to jay.ant

    Let's approach this from a different angle: Why are you trying to generate

    a PDF file manually? Creating a PDF file this way is almost always a

    pre-cursor to writing software to output PDF. It does not make any sense

    for an end user to create a PDF based on the PDF spec. That's why we have

    software that does that. Even if you need a PDF file with a specific

    feature, there is usually no need to hand craft a file: You can just write

    a PostScript file (which is a text format, and can be written based on the

    PostScript spec) and then run it through a PSToPDF converter like

    Distiller.

     

    So again, why do you think you need to write a PDF file in a text editor?

     

    Karl Heinz Kremer

    PDF Acrobatics Without a Net

     

    khk@khk.net

    http://www.khkonsulting.com

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 5:20 AM   in reply to jay.ant

    Jay,

     

    I don't quite understand what you want to accomplish, but it sounds like

    some level of HTML to PDF conversion. Yes, there are existing solutions,

    and they may seem to be expensive, but based on my own experience, they are

    worth what you pay for (and more). It may seem that building your own

    solutions could be cheaper, but again, based on my own experience, you will

    waste a lot of time and money to come up with something that works as well

    as anything that you can buy today.

     

    Based on your problems coming up with a correct XRef table, it looks like

    you do not have a deep enough understanding of the PDF spec to do this.

    I've read the spec too often to count. It's not an easy to read document,

    but you need to read and understand every part of it. There is no way

    around it.

     

    I work mostly on software that processes existing PDFs, and almost every

    PDF file that is generated by somebody who thought that they needed to

    re-invent the wheel and write their own PDF generator, they end up writing

    corrupt PDF. Go with one of the established solutions, it will pay for

    itself in the long run.

     

    If you really want to write PDF in an editor, you need an editor that shows

    you byte offsets. I use vim in it's binary mode.

     

    Karl Heinz Kremer

    PDF Acrobatics Without a Net

     

    khk@khk.net

    http://www.khkonsulting.com

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2013 4:45 AM   in reply to jay.ant

    Hi at all

    First of all, sorry for my bad english. Im a german. But i do my best :-)

     

    I'm working on a project. There i have to search for a possibility to creat pdf's on WinCE. The problem is, therfore are no pdf creater available. So i have chosen to do it on myself. I write it with notepad and a hex-editor. I created a pdf that contains only text. My problem now is the xref table, the stream length works fine. I got the same problem as the Thread opener. Adobe corrects my file and so wants to save it. But i cant find any failure in my xref table. I built it with the hex-editor. I opened the file there and then selected the first number of every object, read the Byte-Number and wrote it in the xref table.

     

    Here is my pdf: http://www.file-upload.net/download-7065580/TestdateiForWWW.pdf.html

     

    I would be very thanksful if you can help me. I don't have any idea what i do wrong.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2013 4:55 AM   in reply to Tobi90

    Welcome to a long journey.

    I have to say that writing in this way is a dead end; everyone eventually (soon) has to write software to generate the PDF, and it is better to start sooner rather than later, in my opinion.

    Ok... I like to answer questions with questions.

    1. What do the characters in the Info dictionary represent?

    2. What do you understand the line "0 10" to exactly mean in the xref?

    3. What do you understand the /Size 10 to exactly mean in the trailer?

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2013 5:24 AM   in reply to Test Screen Name

    Well i know, i dont have the best way to create a pdf document. But i only need it to display text and i need it as quickly as possible.

     

    But thanks for your fast answer!

     

    1) Ok, i have to say i copied this. In my opinion it isnt really important for validating the pdf. I thought i look at this when my pdf is valid. This are meta datas that document some data about the creation of the file.

    2) Its the number of indirect objects in the pdf document. I thought i am right with 10. But after your question i see i forgot the not existing object 0, right? But you asked for exactly... "0" represents the numer of the first indirect object in the document and "10" represents the number of indirect objects in the document.

    3) This size represents the same as the "10" in the xref. It's the number of indirect objects. Here i missed the indirect object 0 too, i think.

     

    Many thanks for your help!!!

     

    EDIT: Ok, that helped out for the problem that adobe want to correct my file. But when printing there still is a message that my file is corrupted. Occurs this cause of my info dictionary?

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2013 5:25 AM   in reply to Tobi90

    1) What you are putting in is basically junk; the dates must follow particular formats, and will be readable text; and the other things should (at the basic level) be regular ASCII text. It's important to get Producer or Creator right at the earliest opportunity, because it identifies your software which made the file. In Adobe Reader or Acrobat, File > Properties will show these. In fact a "modern" PDF should use XML metadata instead of an Info dictionary.

     

    2,3) These didn't look right to me, so try that. I see the "10" in xref as "number of lines following", rather than "number of objects" even if these are closely related.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2013 5:33 AM   in reply to Test Screen Name

    You REALLY need to read ISO 32000-1:2008, the PDF standard.

     

    Alternatively to that, there are various books from Oreilly and others that can teach you about PDF.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2013 6:12 AM   in reply to lrosenth

    Thanks for your answers!

     

    @ Screen Name:

    1) Ok, your right. I corrected it.

     

    2) Ok, you probably are right. But in my cases it always was the same.

     

    @Irosneth

    Thanks for the documents. I will study the ISo-document. But mostly it dont describe the failures, so it isnt very helpful because then you have to check the whole document.... I think to buy a bok is a little oversized for me. I only want to show text in the simplest form it is possible.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2013 6:31 AM   in reply to Tobi90

    Nobody can stop you doing that, and it may even work for your own project, but I really wish you wouldn't distribute a file as a model for people who "don't want to learn PDF, nor buy or write software". I think it will cause them no end of issues. I write as someone who's spent the last 15 years seeing the kinds of deep water PDF beginners get in to.

     

    PDF NEEDS TO BE WRITTEN BY SOFTWARE. Good software. Really.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2013 6:58 AM   in reply to Test Screen Name

    Hm..ok, if you show me a good pdf-creator for winCE, i will use it. But i spent a day on searching for such a pdf creatorand there is no one.

     

    I try to explain you my problem. In my company we produce machines. They produce statistics about that they do. Now i want to save these statistics in a pdf-file. But there is no pdf-creator, so we have to write one for our use. And i am a student and dont cost much, so i have this damn job to write such a pdf creator. And becaouse of we have many different machines, it should be as easy as it could be to adapt the file from the old machine to the statistics from the other machine. And i cant do this for the whole company, so the others must be able to adapt it too.

     

    I hope you can understand it.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2013 7:18 AM   in reply to Tobi90

    There are numerous open source libraries for creating PDF files in languages from C to Java to Perl to C# to …..

     

    Why can't you simply use one of them?

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2013 3:08 PM   in reply to lrosenth

    I thought I would mention some additional problems. Acrobat X doesn't complain about them, but they are invalid and any software will potentially complain or fail.

     

    1. Missing Widths in font descriptor. It is surprising that this got past. I'd recommend that if you want a simple sans serif font that you use the Helvetica and Helvetica-Bold standard fonts. Or for any other font good practice is to embed it. Arial is not a "magic" font which is guaranteed to be available.

     

    2. Acrobat preflight rejects the file. Probably this is because of the last piece of the content stream

    BT

    29 746 m 595 746 l 3 w s

    30 713 m 595 713 l 0.7 w s

    30 581 m 595 581 l 0.7 w s

    30 559 m 595 559 l 0.7 w s

    30 426 m 595 426 l 0.7 w s

    30 34 m 595 34 l 3 w s

    ET

    These line drawing operators are not valid in a text object. However, even fixing this fails some preflights. I believe it violates more restrictions in table 9 (section 8.2).

     

    3. You inherit Resources and MediaBox. This is of course permitted, but it does cause a number of real world problems so it is best avoided. To streamline the file Resources can point to the same indirect object.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 16, 2013 11:53 PM   in reply to Test Screen Name

    Thanks for this much suggestions!

     

    @iroseneth: I have to write this in vbscript. We want to implement this in a visualization we use. And the only way to write a function is to write a script in VBScript.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 17, 2013 12:49 AM   in reply to Tobi90

    IT WORKS, its unbelievable, but it works

     

    Im so happy! Many thanks to you!!! You had the right suggestion to make it work. THANKS!

     

    My last problem was a uncorrect date in the info-Dictionary :-(

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points