PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 9:08 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Wed Jul 19, 2017 1:57 pm 
Offline

Joined: Wed Jul 19, 2017 1:51 pm
Posts: 8
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 19, 2017 2:43 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 19, 2017 3:48 pm 
Offline

Joined: Wed Jul 19, 2017 1:51 pm
Posts: 8
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 19, 2017 4:05 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 19, 2017 4:09 pm 
Offline

Joined: Wed Jul 19, 2017 1:51 pm
Posts: 8
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 19, 2017 5:27 pm 
Offline

Joined: Wed Jul 19, 2017 1:51 pm
Posts: 8
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.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 20, 2017 8:18 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 20, 2017 11:21 am 
Offline

Joined: Wed Jul 19, 2017 1:51 pm
Posts: 8
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 :)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 20, 2017 1:33 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 24, 2017 11:24 am 
Offline

Joined: Wed Jul 19, 2017 1:51 pm
Posts: 8
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 125 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group