|
Rank: Newbie Groups: Member
Joined: 10/7/2011 Posts: 3
|
Hi,
I'm trying to create a pdf with 3 pages. Two pages with text and one page inserts a map as a png image. The image is landscape but the text should be portrait. I've tried several things but the image keeps coming out portrait. Can some one direct me to how to load the image into a landscape page while keeping the other two images as portrait. fyi im working in vb.net
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, If you use HTML to PDF, then the easiest way is to do them in two separate conversions: one for the landscape portion and one for ht portrait portion. The only difference between "landscape" and "portrait" is HtmlToPdf.Options.PageSize. You would set them to different sizes respectively. Once you are done with two separate conversions, you will have two different PdfDocument object. You would then call PdfDocument.Merge to merge them into a single document. It will be something like this:
Code: C#
//Convert the first portion
PdfDocument doc1 = new PdfDocument();
HtmlToPdf.Options.PageSize = your_landscape_paper_size;
HtmlToPdf.ConvertUrl(url1, doc1);
//Convert the second portion
PdfDocument doc2 = new PdfDocument();
HtmlToPdf.Options.PageSize = your_portrait_pager_size;
HtmlToPdf.ConvertUrl(url1, doc2);
//Merge them
PdfDocument result = PdfDocument.Merge(doc1, doc2);
Hope this helps. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 10/7/2011 Posts: 3
|
for the image im using the renderer
Code: Visual Basic.NET
Dim image As New AcmImage(MapScreenshoot)
Dim docmap As New PdfDocument
Dim Renderer As New AcmRender(docmap)
Renderer.Render(image)
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You can do the same. Just do your image portion into a different PdfDocument (in your case docmap) and then merge it with the rest. You would call Renderer.SetDefPageSize to set your paper size before calling Renderer.Render(image).
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 10/7/2011 Posts: 3
|
Thanks!
|
|