PJL commands in pdf files: OK?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

PJL commands in pdf files: OK?

carsten hammer
Hi,
I recently got some pdf files that contain before and after the pdf
bytestream a few lines PJL "rubbish". Though I would say this is not
valid according to the pdf reference it seems to work in most cases.
Acrobat 8 does not seem to care. Some of these files get problems after
itext does some manipulations on them (on some printers, ghostscript
says xref rebuild). Are you aware of limitations of itext to work with
such "broken" pdf? Is it right that I call them "broken" or did just not
read  the pdf reference right and this is valid?
Best regards,
Carsten


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Reply | Threaded
Open this post in threaded view
|

Re: PJL commands in pdf files: OK?

iText mailing list
Carsten Hammer wrote:

> Hi,
> I recently got some pdf files that contain before and after the pdf
> bytestream a few lines PJL "rubbish". Though I would say this is not
> valid according to the pdf reference it seems to work in most cases.
> Acrobat 8 does not seem to care. Some of these files get problems after
> itext does some manipulations on them (on some printers, ghostscript
> says xref rebuild). Are you aware of limitations of itext to work with
> such "broken" pdf? Is it right that I call them "broken" or did just not
> read  the pdf reference right and this is valid?
> Best regards,
> Carsten

It's not OK for a PDF file NOT to start with %PDF. My guess is that when
tools say that the xref is rebuilt, the byte offsets of each PDF object
had to be changed to take the extra bytes into account (the Cross
Reference table tells the viewer where to find every object in the PDF
file).

"Some" rubbish is allowed at the end of the PDF file, but not too much.
 From the top of my head, I'd say you may not have more than 1028 bytes
of rubbish, BUT you should check that number AND different viewers will
have a different tolerance.

I'd need some test PDFs to find out what happens when iText manipulates
them.
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
mkl
Reply | Threaded
Open this post in threaded view
|

Re: PJL commands in pdf files: OK?

mkl
In reply to this post by carsten hammer
> "Some" rubbish is allowed at the end of the PDF file, but not too much.

Actually no rubbish at all is allowed by the PDF standard itself. According to specification (ISO 32000-1:2008 Abschnitt 7.5.5, ähnlich in früheren PDF-Spezifikationen) the %%EOF-line has to be the final one of the document:

"The last line of the file shall contain only the end-of-file marker, %%EOF."

>  From the top of my head, I'd say you may not have more than 1028 bytes
> of rubbish, BUT you should check that number AND different viewers will
> have a different tolerance.

Adobe Acrobat and Reader are a bit lax about these specification parts. The Acrobat 9 implementation notes state:

"Acrobat viewers require only that the %%EOF marker appear somewhere within the last 1024 bytes of the file."

Some people utilize this leniency to add some own data to PDF documents.

This does not imply, though, that this is in accordance to specification. Strictly speaking, such PDF files are broken.

Regards,   Michael.

-----Ursprüngliche Nachricht-----
Von: 1T3XT info [mailto:[hidden email]]
Gesendet: Samstag, 13. Dezember 2008 11:57
An: Post all your questions about iText here
Betreff: Re: [iText-questions] PJL commands in pdf files: OK?

Carsten Hammer wrote:

> Hi,
> I recently got some pdf files that contain before and after the pdf
> bytestream a few lines PJL "rubbish". Though I would say this is not
> valid according to the pdf reference it seems to work in most cases.
> Acrobat 8 does not seem to care. Some of these files get problems after
> itext does some manipulations on them (on some printers, ghostscript
> says xref rebuild). Are you aware of limitations of itext to work with
> such "broken" pdf? Is it right that I call them "broken" or did just not
> read  the pdf reference right and this is valid?
> Best regards,
> Carsten

It's not OK for a PDF file NOT to start with %PDF. My guess is that when
tools say that the xref is rebuilt, the byte offsets of each PDF object
had to be changed to take the extra bytes into account (the Cross
Reference table tells the viewer where to find every object in the PDF
file).

"Some" rubbish is allowed at the end of the PDF file, but not too much.
 From the top of my head, I'd say you may not have more than 1028 bytes
of rubbish, BUT you should check that number AND different viewers will
have a different tolerance.

I'd need some test PDFs to find out what happens when iText manipulates
them.

--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Reply | Threaded
Open this post in threaded view
|

Re: PJL commands in pdf files: OK?

Leonard Rosenthol
The ability to have "rubbish" at the start or end of the PDF was one  
of the things that was done during the Adobe->ISO transition of PDF  
1.7 to ISO 32000 to tighten down the PDF file format for the future.

So while a file with such 'rubbish' is PDF 1.7 compliant, for example,  
it is NOT ISO 32000 compliant.  And as noted, Adobe Acrobat/Reader are  
able to properly consume the file.  HOWEVER, like iText, any such  
'rubbish' is tossed during processing.

Leonard

On Dec 13, 2008, at 1:04 PM, Michael Klink wrote:

>> "Some" rubbish is allowed at the end of the PDF file, but not too  
>> much.
>
> Actually no rubbish at all is allowed by the PDF standard itself.  
> According to specification (ISO 32000-1:2008 Abschnitt 7.5.5,  
> ähnlich in früheren PDF-Spezifikationen) the %%EOF-line has to be  
> the final one of the document:
>
> "The last line of the file shall contain only the end-of-file  
> marker, %%EOF."
>
>> From the top of my head, I'd say you may not have more than 1028  
>> bytes
>> of rubbish, BUT you should check that number AND different viewers  
>> will
>> have a different tolerance.
>
> Adobe Acrobat and Reader are a bit lax about these specification  
> parts. The Acrobat 9 implementation notes state:
>
> "Acrobat viewers require only that the %%EOF marker appear somewhere  
> within the last 1024 bytes of the file."
>
> Some people utilize this leniency to add some own data to PDF  
> documents.
>
> This does not imply, though, that this is in accordance to  
> specification. Strictly speaking, such PDF files are broken.
>
> Regards,   Michael.
>
> -----Ursprüngliche Nachricht-----
> Von: 1T3XT info [mailto:[hidden email]]
> Gesendet: Samstag, 13. Dezember 2008 11:57
> An: Post all your questions about iText here
> Betreff: Re: [iText-questions] PJL commands in pdf files: OK?
>
> Carsten Hammer wrote:
>> Hi,
>> I recently got some pdf files that contain before and after the pdf
>> bytestream a few lines PJL "rubbish". Though I would say this is not
>> valid according to the pdf reference it seems to work in most cases.
>> Acrobat 8 does not seem to care. Some of these files get problems  
>> after
>> itext does some manipulations on them (on some printers, ghostscript
>> says xref rebuild). Are you aware of limitations of itext to work  
>> with
>> such "broken" pdf? Is it right that I call them "broken" or did  
>> just not
>> read  the pdf reference right and this is valid?
>> Best regards,
>> Carsten
>
> It's not OK for a PDF file NOT to start with %PDF. My guess is that  
> when
> tools say that the xref is rebuilt, the byte offsets of each PDF  
> object
> had to be changed to take the extra bytes into account (the Cross
> Reference table tells the viewer where to find every object in the PDF
> file).
>
> "Some" rubbish is allowed at the end of the PDF file, but not too  
> much.
> From the top of my head, I'd say you may not have more than 1028 bytes
> of rubbish, BUT you should check that number AND different viewers  
> will
> have a different tolerance.
>
> I'd need some test PDFs to find out what happens when iText  
> manipulates
> them.
>
> --
> Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit  
> allen: http://www.gmx.net/de/go/multimessenger
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,  
> Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to  
> help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> iText-questions mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
>


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Reply | Threaded
Open this post in threaded view
|

Re: PJL commands in pdf files: OK?

iText mailing list
Leonard Rosenthol wrote:
> So while a file with such 'rubbish' is PDF 1.7 compliant, for example,  
> it is NOT ISO 32000 compliant.

Thank you Michael en Leonard for the clarification!
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
mkl
Reply | Threaded
Open this post in threaded view
|

Re: PJL commands in pdf files: OK?

mkl
In reply to this post by carsten hammer
Leonard,

when looking at the PDF 1.7 spec, I find descriptions that to me look very much like those in the ISO specifications.

Section 3.4.4 states:

"The last line of the file contains only the end-of-file marker, %%EOF. (See implementation note 18 in Appendix H.)"

The referenced implementation note states

"Acrobat viewers require only that the %%EOF marker appear somewhere within the last 1024 bytes of the file."

To me this looks very much like the ISO specification in combination with the new implementation notes. This eventually would mean, that according to the Adobe PDF 1.7 specification, too, rubbish is not allowed, merely tolerated by Adobe viewers. As far as I remember former Adobe PDF specification contained wordings here to the same effect...

Or had there been some clarification stating something different?

Regards,   Michael.

-----Ursprüngliche Nachricht-----
Von: Leonard Rosenthol [mailto:[hidden email]]
Gesendet: Sonntag, 14. Dezember 2008 00:03
An: Post all your questions about iText here
Betreff: Re: [iText-questions] PJL commands in pdf files: OK?

The ability to have "rubbish" at the start or end of the PDF was one  
of the things that was done during the Adobe->ISO transition of PDF  
1.7 to ISO 32000 to tighten down the PDF file format for the future.

So while a file with such 'rubbish' is PDF 1.7 compliant, for example,  
it is NOT ISO 32000 compliant.  And as noted, Adobe Acrobat/Reader are  
able to properly consume the file.  HOWEVER, like iText, any such  
'rubbish' is tossed during processing.

Leonard

On Dec 13, 2008, at 1:04 PM, Michael Klink wrote:

>> "Some" rubbish is allowed at the end of the PDF file, but not too  
>> much.
>
> Actually no rubbish at all is allowed by the PDF standard itself.  
> According to specification (ISO 32000-1:2008 Abschnitt 7.5.5,  
> ähnlich in früheren PDF-Spezifikationen) the %%EOF-line has to be  
> the final one of the document:
>
> "The last line of the file shall contain only the end-of-file  
> marker, %%EOF."
>
>> From the top of my head, I'd say you may not have more than 1028  
>> bytes
>> of rubbish, BUT you should check that number AND different viewers  
>> will
>> have a different tolerance.
>
> Adobe Acrobat and Reader are a bit lax about these specification  
> parts. The Acrobat 9 implementation notes state:
>
> "Acrobat viewers require only that the %%EOF marker appear somewhere  
> within the last 1024 bytes of the file."
>
> Some people utilize this leniency to add some own data to PDF  
> documents.
>
> This does not imply, though, that this is in accordance to  
> specification. Strictly speaking, such PDF files are broken.

--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Reply | Threaded
Open this post in threaded view
|

Re: PJL commands in pdf files: OK?

Leonard Rosenthol
The clarification is that the PDF References aren't "normative" in  
nature - they don't (usually) make final, definitive statements - just  
sort of general ones.  The end of file is more specified in this case,  
but the beginning is not (IIRC).

Leonard



On Dec 14, 2008, at 3:06 PM, Michael Klink wrote:

> Leonard,
>
> when looking at the PDF 1.7 spec, I find descriptions that to me  
> look very much like those in the ISO specifications.
>
> Section 3.4.4 states:
>
> "The last line of the file contains only the end-of-file marker, %
> %EOF. (See implementation note 18 in Appendix H.)"
>
> The referenced implementation note states
>
> "Acrobat viewers require only that the %%EOF marker appear somewhere  
> within the last 1024 bytes of the file."
>
> To me this looks very much like the ISO specification in combination  
> with the new implementation notes. This eventually would mean, that  
> according to the Adobe PDF 1.7 specification, too, rubbish is not  
> allowed, merely tolerated by Adobe viewers. As far as I remember  
> former Adobe PDF specification contained wordings here to the same  
> effect...
>
> Or had there been some clarification stating something different?
>
> Regards,   Michael.
>
> -----Ursprüngliche Nachricht-----
> Von: Leonard Rosenthol [mailto:[hidden email]]
> Gesendet: Sonntag, 14. Dezember 2008 00:03
> An: Post all your questions about iText here
> Betreff: Re: [iText-questions] PJL commands in pdf files: OK?
>
> The ability to have "rubbish" at the start or end of the PDF was one
> of the things that was done during the Adobe->ISO transition of PDF
> 1.7 to ISO 32000 to tighten down the PDF file format for the future.
>
> So while a file with such 'rubbish' is PDF 1.7 compliant, for example,
> it is NOT ISO 32000 compliant.  And as noted, Adobe Acrobat/Reader are
> able to properly consume the file.  HOWEVER, like iText, any such
> 'rubbish' is tossed during processing.
>
> Leonard
>
> On Dec 13, 2008, at 1:04 PM, Michael Klink wrote:
>
>>> "Some" rubbish is allowed at the end of the PDF file, but not too
>>> much.
>>
>> Actually no rubbish at all is allowed by the PDF standard itself.
>> According to specification (ISO 32000-1:2008 Abschnitt 7.5.5,
>> ähnlich in früheren PDF-Spezifikationen) the %%EOF-line has to be
>> the final one of the document:
>>
>> "The last line of the file shall contain only the end-of-file
>> marker, %%EOF."
>>
>>> From the top of my head, I'd say you may not have more than 1028
>>> bytes
>>> of rubbish, BUT you should check that number AND different viewers
>>> will
>>> have a different tolerance.
>>
>> Adobe Acrobat and Reader are a bit lax about these specification
>> parts. The Acrobat 9 implementation notes state:
>>
>> "Acrobat viewers require only that the %%EOF marker appear somewhere
>> within the last 1024 bytes of the file."
>>
>> Some people utilize this leniency to add some own data to PDF
>> documents.
>>
>> This does not imply, though, that this is in accordance to
>> specification. Strictly speaking, such PDF files are broken.
>
> --
> Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit  
> allen: http://www.gmx.net/de/go/multimessenger
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,  
> Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to  
> help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> iText-questions mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
>


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
mkl
Reply | Threaded
Open this post in threaded view
|

Re: PJL commands in pdf files: OK?

mkl
In reply to this post by carsten hammer
Oh...

Ok, in this case let me just state that I'm happy to now have the ISO PDF specification which can be considered normative... ;*)

Regards,   Michael.

BTW,

>The end of file is more specified in this case, but the beginning is not (IIRC).

the beginning also has been specified in quite some detail, "The first line of a PDF file is a header identifying the version of the PDF specification to which the file conforms, [...] %PDF-1.7 [...] %PDF-1.0 ... %PDF-1.6" followed up by an implementation note stating that "Acrobat viewers require only that the header appear somewhere within the first 1024 bytes of the file." This has been in there at least since 1.4...

-----Original Message-----
From: Leonard Rosenthol [mailto:[hidden email]]
Sent: Monday, December 15, 2008 4:06 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] PJL commands in pdf files: OK?

The clarification is that the PDF References aren't "normative" in nature - they don't (usually) make final, definitive statements - just sort of general ones.  The end of file is more specified in this case, but the beginning is not (IIRC).

Leonard



On Dec 14, 2008, at 3:06 PM, Michael Klink wrote:

> Leonard,
>
> when looking at the PDF 1.7 spec, I find descriptions that to me look
> very much like those in the ISO specifications.
>
> Section 3.4.4 states:
>
> "The last line of the file contains only the end-of-file marker, %
> %EOF. (See implementation note 18 in Appendix H.)"
>
> The referenced implementation note states
>
> "Acrobat viewers require only that the %%EOF marker appear somewhere
> within the last 1024 bytes of the file."
>
> To me this looks very much like the ISO specification in combination
> with the new implementation notes. This eventually would mean, that
> according to the Adobe PDF 1.7 specification, too, rubbish is not
> allowed, merely tolerated by Adobe viewers. As far as I remember
> former Adobe PDF specification contained wordings here to the same
> effect...
>
> Or had there been some clarification stating something different?
>
> Regards,   Michael.

--
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
iText-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php