Can not convert PDF file or can not convert all pages of pdf file

Get technical support of PDF Focus .Net in C# and VB.Net
DongPham
Posts: 1
Joined: Mon May 23, 2022 5:18 pm
Contact:

Can not convert PDF file or can not convert all pages of pdf file

Post by DongPham »

Hello,
I am using PDF focus library and I have a issue.
some PDF file can not convert to image.
I convert all pages of PDF file but that miss some page.
Please help to solve this issue.
I use code as below to convert 1st page of pdf file :

Code: Select all

 OpenFileDialog Chonfile = new OpenFileDialog();
            Chonfile.Filter = "All Files (*.pdf)|*.pdf";
            Chonfile.FilterIndex = 1;
            Chonfile.Multiselect = false;
            progressBar_upload.Value = 0;


            // Chonfile.Multiselect = false;
            if (Chonfile.ShowDialog() == DialogResult.OK)
            {
              
                int i = 0;
                string newpath = @"C:\Users\Dong.Pham\Desktop\";



                foreach (string filename in Chonfile.FileNames)
                {
                    //string Npath = newpath + Txt_DocNo.Text + "_" + Txt_extension.Text + "_" + i + ".png";
                    string Npath = newpath + Txt_DocNo.Text + "_" + Txt_extension.Text + ".png";
                   
                    SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();

                    f.Serial = "XXXXXXX";  // I have liscience

                    f.OpenPdf(filename);

                    if (f.PageCount > 0)

                    {

                        //Set 200 dpi and png format

                        f.ImageOptions.Dpi = 200;
                      //  f.ImageOptions.Resize();
                        f.ImageOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
                     //   int width = 1585; // Width in Px
                      //  int height = 850; // Height in Px


                        // f.ImageOptions.Resize(new Size { Width = width, Height = height }, false);
                        f.ImageOptions.Resize(0.5f, 0.5f);

                        progressBar_upload.Value = 50;
                        f.ToImage(Npath, 1);
                        f.ClosePdf();

                        /*
                        for (int page = 1; page <= f.PageCount; page++)
                        {
                            f.ToImage(Npath, page);
                        }    
                        */

                        progressBar_upload.Value = 100;
                    }

                    

                }

            }
code to convert all pages of file pdf :

Code: Select all

  foreach (string filename in Chonfile.FileNames)
                        {
                            //
                            //  string newpath = pathdes+ "\\" + Txt_DocNo.Text  + "_" + i + ".png";
                            // i++;
                            // File.Copy(filename, newpath, true);
                            ///////////////////////////////////////////////
                            ///use sautisoft pdf
                            string newpath = "";
                            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();

                            f.Serial = "XXXXXXXX";

                            f.OpenPdf(filename);

                            if (f.PageCount > 0)

                            {

                                //Set 200 dpi and png format
                                int count_page = f.PageCount;
                                f.ImageOptions.Dpi = 200;

                                f.ImageOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

                                progressBar_upload.Step = 100 / f.PageCount;

                                for (int page = 1; page <= f.PageCount; page++)
                                {
                                    if(page == f.PageCount)
                                    {
                                        progressBar_upload.Value = 100;
                                        
                                    } 
                                    else
                                    {
                                        progressBar_upload.Value = progressBar_upload.Step * page;
                                    }    
                                    

                                    newpath = pathdes + "\\" + Txt_DocNo.Text + "_" + i + ".png";
                                    f.ToImage(newpath, page);
                                    i++;
                                }
                                

                            }

                        }
Oliver
Posts: 45
Joined: Wed Aug 19, 2020 11:59 am
Contact:

Re: Can not convert PDF file or can not convert all pages of pdf file

Post by Oliver »

Hello.

I'll try to help you, but , before, could you send us your PDF (PDFs) file for test?

I'll check why it's happening...

Thanks
Guest

Re: Can not convert PDF file or can not convert all pages of pdf file

Post by Guest »

Oliver wrote: Wed May 25, 2022 11:57 am Hello.

I'll try to help you, but , before, could you send us your PDF (PDFs) file for test?

I'll check why it's happening...

Thanks
Hello @Oliver
Could you please share with me your email address, I will send pdf files for you.
Thank you so much.

Dong Pham
Guest

Re: Can not convert PDF file or can not convert all pages of pdf file

Post by Guest »

Oliver wrote: Fri Jun 03, 2022 8:34 am Hi.

Sure. Our email support@sautinsoft.com

Thanks
Hello Oliver !
Thank you so much for your support
I sent email with attach file for you.
Please help to check email.

Thank you.
Dong Pham


Last bumped by Anonymous on Sat Jun 25, 2022 4:06 pm.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests