PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Copy All Content from a File to Another, on the same page
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3629
Page 1 of 1

Author:  SammuelMiranda [ Wed Jul 19, 2017 1:57 pm ]
Post subject:  Copy All Content from a File to Another, on the same page

Hello, i read a bit on this forum (and other pages) about PdfSharp, and i'm doing great with it!
But still, i could not yet find the answer to this one.

I have 2 files, each with one page.
In file "A" i have a image (for example), and on file "B" i have a text that says "hi!" (again, example).

I want to produce a third file, with ONE page, containing both the image (from file "A") and the text (from file "B").
I now how to merge both files, loading one page from file "A" and the other from file "B". But it would result in a file with 2 pages, and i want to "overlap" the content, merging both pages into one single page.

The result file would start a new page (blank), copy all content (any, the image was an example) from file "A", page 1 and then copy all from file "B" page 1.

How do i do that?
Thanks in advance.

Author:  Thomas Hoevel [ Wed Jul 19, 2017 2:43 pm ]
Post subject:  Re: Copy All Content from a File to Another, on the same pag

Hi!

Check the Two Pages on One sample:
http://www.pdfsharp.net/wiki/TwoPagesOnOne-sample.ashx

It draws two pages side by side on a landscape page and adds some text.

You can use the same routine to draw two pages on top of one another in portrait format.

Note that when drawing page B over page A, then page A will only be visible in areas where page B is transparent.

Author:  SammuelMiranda [ Wed Jul 19, 2017 3:48 pm ]
Post subject:  Re: Copy All Content from a File to Another, on the same pag

I'll test it Thomas, but by the looks of it isn't exactly what i'm looking for.
On that example it initializes a Font ("Verdana") and uses colors and draws contents as images.

It would require me to know the contents of the file beforehand.
I'd like to "continue" to draw on the first file, as if the contents of the second file where draw into it instead.

It might be 2 texts, it might be 2 images, it might even have 2 different fonts on each file.
They must overlap, as they are. Like "moving" all elements from file "B" to file "A", on the same page.

Again, i'll test it, and thanks for the response, but i think it won't be the result i'm searching for.

Author:  Thomas Hoevel [ Wed Jul 19, 2017 4:05 pm ]
Post subject:  Re: Copy All Content from a File to Another, on the same pag

SammuelMiranda wrote:
Again, i'll test it, and thanks for the response, but i think it won't be the result i'm searching for.
I think it will be the result you're looking for. But maybe I misunderstood your requirements.
DrawImage in that case draws PDF pages as they are - text remains text, images remain images.

Author:  SammuelMiranda [ Wed Jul 19, 2017 4:09 pm ]
Post subject:  Re: Copy All Content from a File to Another, on the same pag

Oooohhhhhh .... now i see. I didn't know that.
Then i think i'll just make a little change in the example, and "DrawImage" from both files.

I'll post here to close it if it works.
Thanks again Thomas.

Author:  SammuelMiranda [ Wed Jul 19, 2017 5:27 pm ]
Post subject:  Re: Copy All Content from a File to Another, on the same pag

Didn't work.
One of my pdfs had a 3d object, and the other a "frame". The idea was to overlap the 3d object (from Solidwork) with the "frame" (lines forming a square and some other data).

Thanks anyway Thomas.

Author:  Thomas Hoevel [ Thu Jul 20, 2017 8:18 am ]
Post subject:  Re: Copy All Content from a File to Another, on the same pag

SammuelMiranda wrote:
Didn't work.
In Adobe Reader you can activate the Transparency Grid to see which parts of a PDF page are transparent.

Overlapping two pages only works if the page on top has some transparent regions. A colored frame on a transparent page will work, a colored frame on a white page will hide anything that is below it.
So maybe you just have to find another frame to make this work.

Author:  SammuelMiranda [ Thu Jul 20, 2017 11:21 am ]
Post subject:  Re: Copy All Content from a File to Another, on the same pag

I see.
Maybe there's something ele that would achive what i'm look for (not exactly, but would resolve my issue).

Could i attach the file "A" to file "B" as a link (embed the document, as a attachment so when someone click on it, it open the other file)?
That would be enought for the current purpose. Because i coult have a page from file "B" with a "Click Here", embed the file "A" into this link so it would open as another document - for what i need it's enought.

I was aiming for something bigger, but that would do it - and i also don't know how to :)

Author:  Thomas Hoevel [ Thu Jul 20, 2017 1:33 pm ]
Post subject:  Re: Copy All Content from a File to Another, on the same pag

How about this: create a PDF with two pages (A and B), add a hyperlink to page A that takes the reader to page B (you can use the complete A page as a hyperlink).

Readers can click page A or scroll down with the mouse wheel or scroll down with the PageDown key.

You can jump from one single-page PDF to another single-page PDF and I think the latter can even be embedded in the former, but will the reader understand what to do?

Author:  SammuelMiranda [ Mon Jul 24, 2017 11:24 am ]
Post subject:  Re: Copy All Content from a File to Another, on the same pag

Could be ... not what i was looking for though, but i tested and for some reason the generated document does not include the 3d object.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/