Giter Club home page Giter Club logo

Comments (8)

galkahana avatar galkahana commented on July 20, 2024

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.

vegarringdal avatar vegarringdal commented on July 20, 2024

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.

vegarringdal avatar vegarringdal commented on July 20, 2024

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.

galkahana avatar galkahana commented on July 20, 2024

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.

galkahana avatar galkahana commented on July 20, 2024

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.

vegarringdal avatar vegarringdal commented on July 20, 2024

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.

galkahana avatar galkahana commented on July 20, 2024

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.

vegarringdal avatar vegarringdal commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.