PDA

View Full Version : how to add content to a pdfPage?




schoeringhumer
Sep 2, 2009, 06:56 AM
hiho,

i would like to add some content to my PDFPage.... it would just be an NSString, but i seem to be too silly for that ...

my code now looks like this:

myPDF = [[PDFDocument alloc] init];

PDFPage *page;

page = [[PDFPage alloc]init];

// here i want to add strings or whatever to my page ... but i don't know the name of the function(s) ... can anybody help me ?


[myPDF insertPage:page atIndex:0];

[page release];

[myPdfView setDocument:myPDF];



`lowell`
Sep 2, 2009, 07:49 AM
but i don't know the name of the function(s)

did you check the developer documentation either on ADC or in Xcode? the list of methods and what they do is right there.

i googled your request and found this: http://www.cocoadev.com/index.pl?InsertingPagesInPDFDocumentForPDFViewDisplay among the results. it seems relevant (based on your code, but not your description); maybe it can help.

schoeringhumer
Sep 2, 2009, 08:48 AM
the link you gave me couldn't help me, but thx ...

is anybody out there who can give me the code to e.g. set the label of a pdf-page ...

there is a function which returns the label of a pdfpage as an NSString, but i don't know how to add an normal NSString to the left top side of a page .... could somebody help me ?

`lowell`
Sep 3, 2009, 12:08 AM
the link you gave me couldn't help me, but thx ...

is anybody out there who can give me the code to e.g. set the label of a pdf-page ...

there is a function which returns the label of a pdfpage as an NSString, but i don't know how to add an normal NSString to the left top side of a page .... could somebody help me ?

ha oops

for some reason i thought you were asking how add pages to a doc.. my bad!

schoeringhumer
Sep 4, 2009, 07:14 AM
nobody out there, who has any kind of knowledge about pdfkit ... ?

chown33
Sep 4, 2009, 04:55 PM
nobody out there, who has any kind of knowledge about pdfkit ... ?

PDFKit doesn't create or modify PDF pages. It lets you view PDF documents, access content of the document, add annotations, etc.

http://developer.apple.com/mac/library/documentation/GraphicsImaging/Conceptual/PDFKitGuide/PDFKit_Prog_Conc/PDFKit_Prog_Conc.html

From the summary for PDFPage:

As you might expect, the PDFPage class represents pages in a PDF document. Your application instantiates a PDFPage object by asking for one from a PDFDocument object. PDF page objects are what the user sees onscreen, and a view may display more than one page at a time. You can use PDFPage to render PDF content onscreen, add annotations, count characters, define selections, and get the textual content of a page as an NSString or NSAttributedString object.

Note that in the bold text, there is no mention of "add content to the page".

If you want to add content to a PDF document, you need a PDF renderer or PDF painter. This will often be coupled with a PDF parser.

http://developer.apple.com/mac/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html