Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Apr 08, 2024 8:25 am

Hi,

I'm using Spire.XLS library (c# .NET) and I'm implementing a new feature in the project which export a xls file to pdf file. With the cited library is quite easy but I've an issue. I need that when I export the file the checkboxes that appear inside the sheet, they are transform as pictures... Is it possible ?

When I export the xls file to pdf and then use a PdfImageHelper (Spire.Pdf .NET) the checkboxes are not in the lista of picture that this method returns.

I ask this, becuase when I print the xls file through Microsoft Excel as pdf file, the checkboxes are printed as picture and the method PdfImageHelper retunrs a list with them inside as pictures.

I hope I have exposed my question clearly!

Thanks in advance!

ManuRubio
 
Posts: 10
Joined: Wed Mar 13, 2024 11:16 am

Tue Apr 09, 2024 7:34 am

Hi,

Thanks for your inquiry.
After investigating, the checkbox becomes rectangle after converting Excel file to Pdf file with Spire.Xls. Do you want the checkbox to become image after convertion?

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Apr 09, 2024 7:55 am

Abel.He wrote:Hi,

Thanks for your inquiry.
After investigating, the checkbox becomes rectangle after converting Excel file to Pdf file with Spire.Xls. Do you want the checkbox to become image after convertion?

Sincerely
Abel
E-iceblue support team


Hi,

Exactly! I would like to get the checkbox as image after transformation.

Thank you in advance

ManuRubio
 
Posts: 10
Joined: Wed Mar 13, 2024 11:16 am

Tue Apr 09, 2024 8:52 am

Hi,

I have logged your requirement into our updating system of our product with the ticket number SPIREXLS-5196, our Dev team will to achieve it. Once it is achieved, I’ll inform you in time.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Wed Apr 10, 2024 7:00 am

Hi,

Nice! Thanks for all!

In addition, Is there any way of know the position (X and Y) of the checkbox in the final PDF? At the same way that we can find the X and Y position of any word...

Thank you again!
Best regards!

ManuRubio
 
Posts: 10
Joined: Wed Mar 13, 2024 11:16 am

Wed Apr 10, 2024 8:39 am

Hi,

You can use “PdfTextFinder” class to find text of checkbox and get position of the text, I put the relevant code below for your reference.

Code: Select all
// Create a PdfDocument object
            PdfDocument pdfDocument = new PdfDocument();

            // Load the PDF document from file
            pdfDocument.LoadFromFile(@"../../data/Spire_Pdf.pdf");

            // Get the first page of the PDF document
            PdfPageBase pdfPageBase = pdfDocument.Pages[0];

            // Create a PdfTextFinder object to find text within the PDF page
            PdfTextFinder pdfTextFinder = new PdfTextFinder(pdfPageBase);

            // Find text fragments containing "Check Box 1"
            List<PdfTextFragment> pdfTextFragments = pdfTextFinder.Find("Check Box 1");

            // Iterate through the found text fragments
            foreach (PdfTextFragment pdfTextFragment in pdfTextFragments)
            {
                // Get the position and size information of the text fragment
                System.Drawing.RectangleF rectangleF = pdfTextFragment.Bounds[0];

                // Output the X-coordinate of the text fragment
                Console.WriteLine(rectangleF.X);

                // Output the Y-coordinate of the text fragment
                Console.WriteLine(rectangleF.Y);
            }


Besides, after fixing the issue with SPIREXLS-5196, you can use “pdfImageHelper” class to get image and the position of the image of checkbox.

Code: Select all
 
  // Create a PdfDocument object
            PdfDocument pdfDocument = new PdfDocument();

            // Load the PDF document from file
            pdfDocument.LoadFromFile(@"../../data/Spire_Pdf.pdf");

            // Get the first page of the PDF document
            PdfPageBase pdfPageBase = pdfDocument.Pages[0];

// Create a PdfImageHelper object
            PdfImageHelper pdfImageHelper = new PdfImageHelper();

            // Use the GetImagesInfo method of the PdfImageHelper object to get the image information on the PDF page, and store the result in an array of PdfImageInfo
            PdfImageInfo[] pdfImageInfos = pdfImageHelper.GetImagesInfo(pdfPageBase);

            // Iterate through each element in the PdfImageInfo array
            foreach (PdfImageInfo pdfImageInfo in pdfImageInfos)
            {
                // Output the X-coordinate of the current image
                Console.WriteLine(pdfImageInfo.Bounds.X);

                // Output the Y-coordinate of the current image
                Console.WriteLine(pdfImageInfo.Bounds.Y);
            }


Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Mon Apr 22, 2024 8:31 am

Hello,

Any news about this ticket SPIREXLS-5196?

Thank for all!
Best regards!

ManuRubio
 
Posts: 10
Joined: Wed Mar 13, 2024 11:16 am

Tue Apr 23, 2024 1:32 am

Hi,

Thanks for your following up.
The issue with the number SPIREXLS-5196 isn’t resolved currently. However, I have urged our Dev team to speed up fixing.
In addition, may I ask if you have already purchased our products or are you still evaluating it? If you have purchased, please offer the order number. Thanks in advance.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Apr 23, 2024 6:47 am

Hi,

We are testing differents options to develop our solutions. Right now we are using a trial version of another provider but your product is more interesting for us but we need the feature named before for cover all our use of cases.

Thanks for all and best regards!

ManuRubio
 
Posts: 10
Joined: Wed Mar 13, 2024 11:16 am

Tue Apr 23, 2024 7:10 am

Hi,

Thanks for your feedback.
Once there are any updates about this issue, I'll inform you in time.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Fri Aug 16, 2024 11:33 am

Hi,

Thank you for your patience.
Glad to inform you, we released Spire.XLS 14.8.2 which fixed the issue SPIREXLS-5196. Welcome to download from the following link to test.

https://www.e-iceblue.com/Download/down ... t-now.html

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 330
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.XLS

cron