Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Dec 09, 2014 9:09 am

Hello

Is it possible to do it? I have tried some ways, but it allways loses most of the Pdf data. Showing olny one corner of A3 page. Converter Works finne with A4 format pages. Any tips ?

jyrka
 
Posts: 3
Joined: Fri Dec 05, 2014 11:26 am

Wed Dec 10, 2014 2:11 am

Dear jyrka,

Thanks for your inquiry.

To help us reproduce this issue, please upload the sample document and code snippets to the forum, or you can sent them to burning.liu@e-iceblue.com.
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Wed Dec 10, 2014 6:46 am

Thank you for a reply

Code: Select all
namespace ToImage
{
    public partial class Form1 : Form
    {
        public Form1()
        {
           
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //pdf file
            String file = @"C:\Users\jyrgen\Desktop\Skännitud\201412031030.pdf";


            //open pdf document
           
            PdfDocument doc = new PdfDocument();
            doc.LoadFromFile(file);
            //doc.Split(file);
            //doc.Pages.Add(PdfPageSize.A2);
            doc.PageSettings.Size = PdfPageSize.A3;
            doc.PageSettings.Rotate = PdfPageRotateAngle.RotateAngle0;
            doc.PageSettings.Width = -3000;
            doc.PageScaling = PdfPrintPageScaling.ActualSize;
           
            //doc.PageSettings.Height = 1200;
            //doc.PageSettings.Width = 1000;
            Bitmap bmp = new Bitmap(doc.SaveAsImage(0)) ;
            //bmp.SetResolution(0.0005F, 0.0005F);
            //bmp.Height = 1200;
            //bmp.Width =  1000;
            Image emf = doc.SaveAsImage(0, Spire.Pdf.Graphics.PdfImageType.Metafile);
            //emf.VerticalResolution = "700";

           
        Image zoomImg = new Bitmap((int)(emf.Size.Width + 25), (int)(emf.Size.Height + 25));
            using (Graphics g = Graphics.FromImage(zoomImg))
    { 
        g.ScaleTransform(2.0f, 2.0f);
        g.DrawImage(emf, new Rectangle(new Point(10, 20), emf.Size), new Rectangle(new Point(10, 20), emf.Size), GraphicsUnit.Pixel); 

    }
        bmp.Save("convertToBmp.bmp", ImageFormat.Bmp);
        System.Diagnostics.Process.Start("convertToBmp.bmp");
        emf.Save("convertToEmf.png", ImageFormat.Png);
        System.Diagnostics.Process.Start("convertToEmf.png");
        zoomImg.Save("convertToZoom.png", ImageFormat.Png); 
        System.Diagnostics.Process.Start("convertToZoom.png");
    }




        }
    }

It Works well with A4 format Pdf, but not when Pdf is A3 format. As you can see i have tried some things it is pretty much demo code from this website. I olny get About 1/3 of a A3 Page. It also helps when i could get Left upper corner of a page. Now it just displays a Right bottom corner of a page.

jyrka
 
Posts: 3
Joined: Fri Dec 05, 2014 11:26 am

Wed Dec 10, 2014 8:33 am

Dear jyrka,

I have reproduced this issue by using Free.Spire.PDF (I guess you used free version) and posted it to our dev team, we will inform you if there is any update.

BTW, I recommend you to use Spire.PDF Pack v3.2.0, it works well with both A3 and A4 format, you can download it via link below:
http://www.e-iceblue.com/downloads/spire.pdf_3.2.0.zip
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Wed Dec 10, 2014 8:51 am

Thank you for a fast reply,

3.2.0 worked

jyrka
 
Posts: 3
Joined: Fri Dec 05, 2014 11:26 am

Wed Dec 10, 2014 9:01 am

Dear jyrka,

Please feel free to contact us if you have any problems.
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Return to Spire.PDF