COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

Inserting comments into PDF stream - how?

• Email
• Follow

I am creating a PDF stream manually (long story, don't ask) and when
debugging the resulting PDF by looking at the raw PDF stream, it would
be really handy if I could tell which parts of the PDF stream came
from which parts of my code, so I was trying to find some way to
insert comments into the PDF stream that I can see when looking at the
PDF contents, but don't affect the output when loading the PDF into

I came up with this:
(my comment here) pop
which I thought would create a string object on the stack and then pop

Any suggestions on how I can insert stuff into the PDF stream that
of the PDF stream?

Thanks,
Chris

 0

See related articles to this posting

In article <18d73941-e9dd-45d6-9036-
chris.shearer.cooper@gmail.com says...

> from which parts of my code, so I was trying to find some way to
> insert comments into the PDF stream that I can see when looking at the
> PDF contents, but don't affect the output when loading the PDF into
>
> I came up with this:
> (my comment here) pop
> which I thought would create a string object on the stack and then pop

PDF doesn't have a pop operator, that's PostScript ;-)

> Any suggestions on how I can insert stuff into the PDF stream that
> of the PDF stream?

Outside the stream you could use the comment character '%'. Inside
streams you could use:

q
BT
Tr 3
ET
Q

This sequence saves the graphics state, starts a text sequence, sets the
text rendering mode to 3 (neither stroke nor fill, invisible) 'shows'
your comment, ends the text sequence and restores the graphics state.

Should have no side effects. Note, I'm assuming you won't emit this part
way through a text block, you can't nest these, so you need to know if
you are already in a text block, in which case just don't emit BT/ET.

Ken

 0

On Jun 16, 4:35=A0pm, Chris Shearer Cooper
<chris.shearer.coo...@gmail.com> wrote:
> ...
> insert comments into the PDF stream that I can see when looking at the
> PDF contents, but don't affect the output when loading the PDF into
> ...

If by =91stream=92 you actually mean =91contents stream=92, I would go with=
:

BX (comment text goes here) COMMENT EX

This works anywhere between =91complete commands=92; that is, take care
not to insert it between an operator and its operands, between
operands, or inside inline data.

BX/ EX delimit the so-called =91compatibility sections=92, meaning =91ignor=
e
any unrecognized operators, together with their operands=92. And,
=91COMMENT=92 is an unknown (non-existent) operator; your =91pop=92 should =
do
the job too (personally I find =91COMMENT=92 more descriptive).

There are other uses of streams in PDF, like image data, but I don=92t
think you will find any way to insert comments there.

 0

On Jun 16, 6:35=A0am, Chris Shearer Cooper
<chris.shearer.coo...@gmail.com> wrote:
> I am creating a PDF stream manually (long story, don't ask) and when
> debugging the resulting PDF by looking at the raw PDF stream, it would
> be really handy if I could tell which parts of the PDF stream came
> from which parts of my code, so I was trying to find some way to
> insert comments into the PDF stream that I can see when looking at the
> PDF contents, but don't affect the output when loading the PDF into
>
> I came up with this:
> (my comment here) pop
> which I thought would create a string object on the stack and then pop
>
> Any suggestions on how I can insert stuff into the PDF stream that
> of the PDF stream?
>
> Thanks,
> Chris

Hi Chris, could you shed more light on your debugging method and tools
you would use to carry it out ?

I want to debug why pdftk.exe doesnt uncompress all streams of a
certain pdf file I have. If I substitute some text by replacement
text, using acrobat, foxit or infix, then it would uncompress the
stream. Its very finicky. I want to know if multivalent is any better.

Thanks

 0

3 Replies
556 Views

Similar Articles

12/13/2013 2:02:47 AM
page loaded in 15039 ms. (0)

Similar Artilces:

how to put my pdf "file" (actually a byte array) into iText PDF output stream?
We are trying to replace an existing Servlet with the "iText" SilentPrintServlet to accomplish two things: do a silent print of the pdf to the user's printer, and display the pdf without any menus in a new browser window. I've got all the plumbing working, I can use iText document.add(Chunk("HELLO WORLD") to test our proof of concept and it does everything I need it to do. The problem comes when trying to plug in our existing, extensive code base that generates a byte[] containing a complete PDF. The problem comes in figuring out how the heck I get my byte[] in the...

I would like to have comments extracted from pdf file using either AA, or AR or pdftk (or any other utility which can run on Linux and/or MacOSX). Sure I can "Copy and Paste" each comment but I want "one shot" solution Thank you in advance. Victor Hi Victor, On Jan 3, 9:49=A0am, victor <viv...@gmail.com> wrote: > I would like to have comments extracted from pdf file using either AA, > or AR or pdftk (or any other utility which can run =A0on Linux and/or > MacOSX). Sure I can "Copy and Paste" each comment but I want "one > ...

Inserting EPS into PDF
Hello! I have the following problem: I want to insert Color EPS files (as created with MATLAB or AdobePS driver) into my PDF files. The following code: \documentclass[a4paper,10pt]{report} \usepackage[dvips]{graphicx} \begin{document} Hello world! \includegraphics[width=0.8\textwidth]{test.eps} \end{document} works and creates good DVI and PS files, but the PDF created by pdflatex has only the text and no picture. I have tried other drivers for "graphicx", but no use. So, is it possible? (I am using MiKTeX.) Misza Misza wrote: > Hello! > > I have the following probl...

inserting image to a pdf
Hello list, I a developing site page where there's link that creates an invoice in pdf format(using lout and ghostscript), but my problem is, i would like to insert an image on the pdf output file and i can't figure out how to this. is there any suggstion I can do this? is this any ruby Api to handle this problem? any help would be much appreciated, thanks in advance! Artotoy convert the image to eps. include it in the lout. maybe rmagick can do this. if not use convert. Alex On Feb 7, 2005, at 3:45 PM, arthur.olano@gmail.com wrote: > Hello list, > > I a developing sit...

Inserting PCL into PDF
Hi, Is there a way to insert PCL commands inside PDF files? I need to insert PCL command in each and every page of PDF which directs the specific page to a specific printer tray. Thanks Sapz "sapsy" <Rsapru@gmail.com> wrote: > Is there a way to insert PCL commands inside PDF files? Not in any way that will cause the PCL commands to be printed by Adobe Reader or Acrobat, unless you write an Acrobat plug-in for the purpose, and I'm not sure it is even possible then. ---------------------------------------- Aandi Inston Please support usenet! Post re...

Pdf docs insertion
Hello, I'd like to know how to insert a complete document in pdf into a document written with latex. Shall I consider the external document as an image ? Or is there another way ? For the moment, with \includegraphics, it doesn't work properly, as my external document has 2 pages. Thanks for your help Jeremie On Wed, 07 Sep 2005 17:39:18 +0200, Jeremie JAUFFRIT wrote: > Hello, > > I'd like to know how to insert a complete document in pdf into a document > written with latex. Shall I consider the external document as an image ? > Or is there another way ? ...

Comment in a PDF file
Hello, Is it possible to add a comment in a PDF object (ie page, bookmark) ? Thanks Hubert ...

Enable commenting on PDF files
Acrobat 7 Professional has a feature by which 'Commenting' may be enabled on PDF documents by clicking on 'Enable Comments'. However, this needs to be done manually and when we have over 100 documents, it takes too much time to do this manually. I was wondering if anybody knew of any method (free or commerical) through which this may be done automatically. It would be ideal if there is some sort of an API which could be used for programming. TIA, Vince LtCommander@gmail.com wrote: > Acrobat 7 Professional has a feature by which 'Commenting' may be > enabled on ...

Problem with deflate streams in pdf.
Hi, I am working on a pdf compressor, which decompresses the zlib deflate streams present in the pdf, and compresses the raw data using another compression algorithm(bzip2, LZX or PPM). For zlib streams compressed with window size 12, I'm unable to reconstruct the original pdf, i.e the original compressed stream is different from the recompressed stream, though both streams decompress to the same raw data. The recompressed stream is slightly smaller than the original stream. I am using the zlib library to extract and construct the streams. I have tried giving various combinations of argu...

PDF Primary Hint Stream
Can anyone tell me how to write a PDF's primary Hint stream Im new to PDF Writer and i write my own tool to generate the Linearized PDF and i was able to generate a Non-Linearized PDF without any issues going through the PDF Reference 1.6 Manual, But with the Linearized PDF i couldnt understand about the Hint Table from the reference and that is preventing me from proceeding furthur. If someone sends me a snippet of how a page object hint stream and primary hint steam looks like that will be of great help to me. Thanks in Advance Ashok B "Ashok" <abalasubramanian@inauti...

recompressing the deflate streams in a PDF
Hello, I have a need to recompress the deflate streams that occur in PDF file. What are the issues I should be aware of when I do this? One issue I already know of is the size of the blocks will change and that will cause the offsets to be wrong. So I already have logic to handle these offset changes. Are there any other issues I need to be aware of? For example, are there any CRC or other checksum type of issues? B byaarov@yahoo.com wrote: >I have a need to recompress the deflate streams that occur in PDF >file. What are the issues I should be aware of when I do this? One >...

Insert /ActualText in pdf with a \special
I'm writing some lua-code to reencode a truetype chess font. In this code I'm trying to control search, copy&paste in the pdf by inserting via \special an /Actualtext entry. With the help of the accsupp package and a message in the xetex mailing list, I found this variants which all works: \TeXXeTstate=1 \documentclass{article} \usepackage{accsupp} \begin{document} \special{pdf:literal BT /Span <</ActualText<FEFF004200200043>>> BDC}%=B C A% \special{pdf:literal EMC ET} \special{pdf: /Span <</ActualText<FEFF004200200043>>> BDC}%=B C A%...

Linearized Pdf
Hi, Can anyone help me on providing information about Hint Stream and what it will contain inside the compressed stream. I have to say the whole linearization was not properly documented in the PDF reference manual. Thanks in advance, Julie ...

Make pdf document commentable
Most of the pdf documents I come across have a security setting which says "Commenting: Not Allowed", is it possible to change this and make the pdf document commentable or is it not possible to change it (if not possible, is it some feature that should have been added when creating the document and not possible to add it now ) Thanks, Gree GreenH <Green.Horn.000@gmail.com> wrote: >Most of the pdf documents I come across have a security setting which >says "Commenting: Not Allowed", is it possible to change this and make >the pdf document commentable or i...

Tiff to PDF in Memory Streamed to browser
Hello, I am looking for a way to convert single page Tiff files to PDF's on the fly, in memory, and then streaming them down to the clients browser using the Response.BinaryWrite method. I had a Com tool that did this but there is a bug in converting some of the images into PDF. My Challenge is that I don't want to pay for a libary that does a whole bunch of other things. I will pay for one but I don't want one that cost $500.00 per server. I would not be opposed to writing one myself but I do not want to take the time to learn the PDF File format. Can anybody give me suggest... MA and PDF: Comments from the public and companies http://www.mass.gov/portal/site/massgovportal/menuitem.769ad13bebd831c14db4a11030468a0c/?pageID=itdsubtopic&L=4&L0=Home&L1=Policies%2c+Standards+%26+Legal&L2=Open+Standards&L3=Open+Formats&sid=Aitd ... How to insert bmp's in pdf Hi everybody! I urgently need your help, as I'm sticking to a very big problem (well, for me): I need some code for inserting bitmaps into a pdf file. I'm already able to insert jpgs (which is not very hard once you found the DCTDecode-Filter). But now I'm not getting further. I want to use an XObject. But I always get a graphics-error frm acrobat reader or the picture is absolutely distorted. I think the problem is getting the right stream. Please help! Thanks in advance, Stephie "Stephie" <Stephanie.Mueller@spe-siemens.de> wrote: >Hi everybody! > >... Using CryptSignMessage to insert timestamp into PDF Hello! I am signing PDF files using a PKCS#7 signature created with CryptSignMessage from Microsoft CryptoAPI. It works. But I'd like to add a timestamp (from a TSA server) to my signature. The PDF reference and RFC 3161 say I must add it as an "unauthenticated attribute" (although someone told me it should be "authenticated"), with the Object ID "1.2.840.113549.1.9.16.2.14". My questions : .. can anyone confirm if it should be an "authenticated" or "unauthenticated" attribute? .. what is the data that I must insert into this attribute? I ... inserting multipage pdf document with pdflatex Is there some trick to insert a multipage pdf document in a LaTeX document using pdflatex and graphicx (\includegraphics inserts only the first page)? Thanks. shamara wrote: > Is there some trick to insert a multipage pdf document in a LaTeX > document using pdflatex and graphicx (\includegraphics inserts only the > first page)? Try the package `pdfpages'... ....Rolf -- || Rolf Niepraschk c/o Physikalisch-Technische Bundesanstalt || || Abbestr. 2-12; D-10587 Berlin, Germany || || Tel/Fax: ++49-30-3481-316/490, email: Rolf.Niepraschk@ptb.de || In article <bpvoiv$n0s\$2@...

Automate Enabling Commenting for a PDF possible?
All im after is Enabling Commenting on our newly created PDF files. iTextSharp, the library we used to compose the PDF cant do it and from what i gather only Acrobat 7 Pro can achieve this BUT the user must do this manually by naviagting the menus within the app. We have several PDFs being generated and so to do this manually is not practical. I've explored DLL Injection, Subclassing, issuing FindWindow/SendMessage, and finally the Acrobat Javascript approach: this.submitForm({cURL:"http://mysite/test.aspx", cSubmitAs:"PDF",cUsageRights:submitFormUsageRights.RMA,cPer...