Comments (8)
Yes. Open the pdf file for modification and change each page object to be the same with resect to all keys but the page size (via media box). Copy all keys/values but media box, and add it setting its value to the desired page size
from pdf-writer.
Great, thanks for the fast reply.
Pretty new when it comes to c++, but got one of the samples working now, so how hard can it be.. hehe :-)
from pdf-writer.
Been trying the merging helper and other stuff to try and understand it.
Took and created a sample file, and added some markup to it with acrobat.
But when I merge that into a new file the markup is gone, maybe Im missing something?
Thanks
This is the file I tried to make a copy of:
https://dl.dropboxusercontent.com/u/23375256/testPage.pdf
//create writer/set file to write to
PDFWriter pdfWriter;
pdfWriter.StartPDF(scBasePath +"testpageCopy.pdf", ePDFVersion13);
//create page
PDFPage* page = new PDFPage();
page->SetMediaBox(PDFRectangle(0, 0, 595, 842));
//merge testpage into the into new one
PDFPageMergingHelper(page).MergePageContent(&pdfWriter, scBasePath + "testpage.pdf", 0);
pdfWriter.WritePageAndRelease(page);
//close
pdfWriter.EndPDF();
return 0;
from pdf-writer.
copying would lose most markup but content. there's method to improve that.
but the path that i think that you should take is to actually create a modified version of the original.
i'll write the script and post it soon
from pdf-writer.
actually turns out i already have an example. see here:https://github.com/galkahana/PDF-Writer/blob/master/PDFWriterTestPlayground/ModifyingExistingFileContent.cpp#L95
Let me know if this helps.
Gal.
from pdf-writer.
ok, will have a look at that, for the resizing part.
But merging 2 or more pages with markup, is there a good way to do that?
You said in the first reply that there is a method to improve that :-)
from pdf-writer.
the markups that you added are annotations. the default method copies only the contents streams and media boxes. you can use a hook to copy also the annotations, i wrote about it here:
http://pdfhummus.com/post/45501619928/copying-pages-with-comments
in your case use MergePageContent instead of AppendPDFPageFromPDF, cause you want to set the page box, but the principal of hooking to the final page write is the same.
still...the method of modification should be significantly simpler and safer, taking care of all features of a page, as well as global PDF level features, as you are just modifying the existing PDF.
Gal.
from pdf-writer.
Last sample worked great, but see I need to dig more into the documentation, and learn more c++:-)
Thanks for the help and a huge thanks for making this library.
from pdf-writer.
Related Issues (20)
- Can not modify a document by creating a new form XObject and using it in one of the pages HOT 3
- [Question] - pdf to image HOT 1
- Question about attachments HOT 2
- some example projects in wiki are missing HOT 2
- Streams objects writing problem HOT 2
- Add watermark to PDF HOT 7
- Missing lib.obj file HOT 3
- Android Build Workflow HOT 3
- CIDSet encoding does not conform with ISO 19005-2:2011, ISO 19005-3:2012 (PDF/A-2b or PDF/A-3b) HOT 21
- annotations are lost with PDFDocumentCopyingContext::AppendPDFPageFromPDF HOT 3
- How to draw Bezier curves using PDF-Witer library? HOT 2
- Parse a screenplay into scene objects? HOT 2
- color emojis HOT 16
- Links are removed when documents are merged HOT 8
- 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
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.