Comments (8)
sent back a response via email.
from pdf-writer.
it's sort of by design.
appending pages only appends their graphic data. no interactive. supposed to function like image embedding.
you can extend the copying code to also add links (in PDF lingua they are part of "annotations").
here's an essay discussing how to do it with example code:
https://www.pdfhummus.com/post/45501619928/copying-pages-with-comments
while it deals with comments, the code just copies annotations in general, so - comments, links etc.
from pdf-writer.
CopyingPagesWithComments.cpp works great with a simple pdf file MakingComments.pdf from the example. If you change the pdf file to your own, an exception will be thrown. I tried different files. It works terribly for me
from pdf-writer.
if you're willing to send me a sample i can probably see what the problem is and provide you a working example.
from pdf-writer.
Crashes on line 116
116. EStatusCodeAndObjectIDType result = copyingContext->CopyObject(annotationReference->mObjectID);
from pdf-writer.
hmmm.
I wasn't able to recreate the crash.
created a branch with the code and file as a test - galk.named_dests. created a test with the code of copyingpageswithcomments named AppendWithAnnotations.
generated this output file:
CopyingPagesWithComments.pdf
outside, web, links seem to work. other links - those that got into the file itself don't. ill explain why soon.
As to the error that you experienced, it might be that you have another file that fails on this if somehow the annotation is embedded into the annotation dictionary instead of only being referred to. the code can be arranged to solve this better (either by allowing direct references, or copying the annotation to a new indirect object)...but yeah it is a bit more sophisticated.
as for the problem i saw, that the links don't work, is partly why i didn't bother with links when embedding individual pages. you see, internal links (named destinations) are a global PDF file object, which means it doesnt sit in the page, but rather in the global PDF object (the catalog). so copying individual pages ain't gonna be enough, and any implementation which potentially copy just some of the pages will be faulty.
there are several paths out of this depending what's the end game with embedding the pages in a new document. If this is just one document and you mean to provide overlay on top of it...then best is to create a modified version of the PDF file instead of appending its pages one by one. if you want to merge multiple PDFs, then you will have to write a more sophisticated coed to allow merging such things as named destinations.
in any case there's 2 things here i saw:
- the problem you saw that i wasn't able to recreate - maybe you were using a different file? in that case please provide it to me...maybe it's still a simpler scenario (like the one for comments, or if the links are just plain urls).
- the problem i saw, which is simply because the code is not smart enough to handle named destinations...in which maybe tell me a bit more about what you intend to do with the PDF and we could consider the simplest solution to fit.
Cheers,
Gal.
from pdf-writer.
Yes, you're right, I rechecked the files and sent them to the mail
from pdf-writer.
Well, the proposed fixes worked, thank you
from pdf-writer.
Related Issues (20)
- Color inversion problem occurs when exporting images HOT 1
- infinite loop HOT 2
- Crash when WriteUsedFontsDefinitions HOT 17
- Publish to github releases without PDFWriterTesting HOT 4
- U3D support, 10 years later HOT 10
- `Segmentation fault (core dumped)` just for adding `PDFWriter pdfWriter` in the `h` file HOT 11
- Fail to draw rectangle to pdf,if rectangle larger than(595x842) HOT 2
- german umlaute diacritic not rendered properly HOT 2
- Make a PDF with an image in memory HOT 4
- Double hex encoding in AbstractContentContext::TJHexLow HOT 3
- Perfectly kosher bug :) HOT 13
- bug: Stack overflow with Invalid PageTree HOT 1
- bug: Stack Overflow when loop in ParseNewObject -> ParseExistingInDirectStreamObject HOT 1
- bug: Requested Allocation Size too big HOT 2
- bug: Heap Use-after-free HOT 1
- bug: Allocation size too big when /Count is high HOT 2
- This line : ` status = pdfWriter.StartPDF(completePathToEmptyPages, ePDFVersion13, logConfiguration)` causes : `Segmentation fault (core dumped)` HOT 8
- PDFParser::ParseFileDirectory,Unexpected object at xref start HOT 9
- Seg Fault HOT 1
- How to modify existing Annots ? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdf-writer.