Quantcast
Channel: Aspose.Pdf Product Family
Viewing all 1038 articles
Browse latest View live

How to position html elements in PDF

$
0
0
Hello,

I'm trying to position an html element, a table in my case, in a pdf document. I tried various methods and nothing seems to work. Please tell me what I'm doing wrong.

Here's the code, which is super simple:

Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

//Create a section in the pdf document
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

//Create string variables with text containing html tags
            string s = @"
                <table style='position:relative;left:500px;background-color:blue;'>
                    <tr>
                        <td>cell1</td>
                    </tr>
                </table>

            ";

//Create text paragraphs containing HTML text
Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(s);
text1.IsHtmlTagSupported = true;

//Add the text paragraphs containing HTML text to the section
sec1.Paragraphs.Add(text1);

//Save the pdf document
pdf1.Save(@"c:\TestHtml.pdf");

***

I also tried with the new API, without luck:

string html = @"
                <table style='position:relative;left:500px;background-color:blue;'>
                    <tr>
                        <td>cell1</td>
                    </tr>
                </table>
            ";
            // instantiate HtmlLoadOptions object and set desrired properties.
            HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
            htmlLoadOptions.PageInfo.Margin.Bottom = 10;
            htmlLoadOptions.PageInfo.Margin.Top = 20;
            //Load HTML string
            Document doc = new Document(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(html)), htmlLoadOptions);
            //Save PDF file
            doc.Save(@"c:\output.pdf");


I also tried with position:absolute or fixed, and it doesn't work. 
Any idea?


Add Image to Existing PDF File - inverted Co-ordinate issue.

$
0
0
Hi,
I am using Aspose PDF to add an image to an existing PDF. I am using the code snippet from http://www.aspose.com/docs/display/pdfjavaold/Add+Image+to+Existing+PDF+File
But I found a difficulty with the final PDF generation. The position which is mentioned in the com.aspose.pdf.Matrix, for some PDF the co-ordinate (0,0) start from the left bottom of the page and for some PDF it start form the left top of the page.
So i want to know is there any way possible to find out the starting position of the co-ordinate for the PDF prior to set the co-ordinates so that I can make the necessary changes with the co-ordinate.

Thanks and Regards 
Reetam

a very serious problem

$
0
0
Hi

    I met a serious problem. If use Image and HtmlFragment object to save pdf file. The pdf file open alert a error. and Image only show one.I use 10.7.0.0 version,and I test new version 11.0.0.0 have same problem.Below is the return code of the problem:

     Document document = new Document();
                var page = document.Pages.Add();
                Image image = new Image();            
                image.ImageStream = new FileStream(@"c:\aa.jpg", FileMode.Open);
                var html = new HtmlFragment("<div>aaa</div>");
                page.Paragraphs.Add(html);
                page.Paragraphs.Add(image);
                page.Paragraphs.Add(html);
                page.Paragraphs.Add(image);
                using (var fileStream = new FileStream(@"C:\\TestPDF.pdf", FileMode.OpenOrCreate))
                {
                    document.Save(fileStream);
                    document.FreeMemory();
                    document.Dispose();
                }

This problem is more serious for our products.Please help me as soon as possible, thank you very much.



SVG to PDF: With Base 64 image

$
0
0
I have a SVG file with image in it. I am not allowed to upload SVG file directly here. So uploading the set6.svg.xml (XML format). On converting SVG to PDF, I don't see the image in PDF. 

Request File: set6.svg
Created PDF file: set6.pdf

Here is my code C#:

 // Instantiate SvgLoadOptions object using SVG load option
            Aspose.Pdf.SvgLoadOptions loadopt = new Aspose.Pdf.SvgLoadOptions
            {
                
            };
        
            loadopt.ConversionEngine = Aspose.Pdf.SvgLoadOptions.ConversionEngines.NewEngine;

            // Create Document object
            Aspose.Pdf.Document doc = new Aspose.Pdf.Document(@"my path..set6.svg", loadopt);

            // Save the resultant PDF document
            doc.Save(@"my path.set6.pdf");

PDFNEWNET-35297

$
0
0

Hi,

 

I found this thread ( http://www.aspose.com/community/forums/permalink/467400/467400/showthread.aspx ) which mentions a feature request (PDFNEWNET-35297) for enabling printing defaults (e.g. duplex) in documents generated using Aspose.Pdf.

 

Can you tell me whether this has ever been implemented, and if so in which version of Aspose.Pdf?

 

Many thanks,

Peter




This e-mail together with any attachments is confidential and may be subject to legal privilege. If you are not the intended recipient, please:
(a) advise us immediately by return e-mail;
(b) do not forward, print, copy, disclose or use this e-mail and/or attachments in any way; and
(c) delete this e-mail and/or attachments, and destroy all paper copies of these which may have been printed.
OSPRI New Zealand is not responsible for any changes made to this e-mail and/or attachments after sending by OSPRI New Zealand.

This message was posted using Support2Forum.

Exporting pdf as png shows dark banding

$
0
0
Hi Friends,
I am having a problem with converting PDF to PNG. The resulting PNG has a dark band that is not present in the PDF (though may be a badly rendered layer in the PDF). I hope it's something I'm doing wrong and not a bug in the Aspose library (because then I could fix it!). The code snippet is attached, and the results look like this, below (blurred intentionally). I can provide the original file to Aspose team directly but can't post it here.

Thank you for any assistance!

Ron 

PDF to Excel Not Working

$
0
0
See the attached PDF, it's a very simple test. The generated XLS is not complete. com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("c:/tools/test2.pdf"); com.aspose.pdf.ExcelSaveOptions e = new com.aspose.pdf.ExcelSaveOptions(); pdfDocument.save("c:/tools/ConvertedFile.xls", e); Using aspose.pdf-10.9.0.jar

JpegDevice.Process ignores resolution

$
0
0
I have a pdf.  It is sized 32.58" x 73.91" (inches).

Trying to export as jpeg, I create a JpegDevice with:
JpegDevice jpegDevice = new JpegDevice(new Resolution(300), 100);
Then run the process command on the page:
jpegDevice.Process(pdfDocument.Pages[x], imageStream);

And no matter what resolution (I assume the intention is dots per inch) I choose (300, 150, 100, etc), the image always comes out with resolution 2443 x 5543 pixels, which is 75 dots per inch.     The image pixel size should be (inches X dpi).   The resolution parameter of the JpegDevice is not being used to properly size the image.  If I choose 300 dpi resolution, the resulting image should be 9774 x 22173.

Please advise.  I am using pdf 9.5

Thank you,

Jason

Opening Html document throws Unable to cast object of type '.' to type '.'

$
0
0
Trying to open the attached html document with Aspose.Pdf vers 11.0.0 fails and throws an error Unable to cast object of type '.' to type '.'

Here is the sample code :

var inp = "page1.html";
var outp = "page1.pdf";

HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
htmlLoadOptions.PageInfo.Margin.Bottom = 10;
htmlLoadOptions.PageInfo.Margin.Top = 10;
htmlLoadOptions.PageInfo.Margin.Left = 10;
htmlLoadOptions.PageInfo.Margin.Right = 10;
htmlLoadOptions.PageInfo.Height = 840;
htmlLoadOptions.PageInfo.Width = 750;
htmlLoadOptions.PageInfo.IsLandscape = false;


var doc = new Document(inp, htmlLoadOptions);
doc.Save(outp);

Adding footer details to Existing PDF

$
0
0
hi Support,

I need some help in getting footer section with details below

Date: on left bottom
Note: on center bottom
Page Number: on right bottom,

On existing static PDF document of 20 pages (combination on both Patriot and Landscape layouts).
I saw adding a text section using PdfFileStamp for adding page numbers. where i would like to add all the three details above in a specified alignment.

Please let me know.

Thanks,

reference objects in xml

$
0
0

Hi,

I am using xml template for generating pdf document using latest version.
I am not able to reference sections or segments by their ID in xml anymore
com.aspose.pdf.Document pdfDoc = new com.aspose.pdf.Document();
pdfDoc.bindXml("D:\\templates\\sampleTags.xml");


Following used to work with the legacy version.
Pdf pdfDoc = new Pdf(bindXML("D:\\templates\\sampleTags.xml", null);
pdfDoc.bindXml("D:\\templates\\sampleTags.xml");
Section section = (Section)pdfDoc.getObjectByID("mainSection")

Sample xml file:
<?xml version="1.0" encoding="utf-8" ?>
<Pdf xmlns="Aspose.Pdf"><Section id="mainSection"> </Section></Pdf>

Thanks
Mamatha

 

 

Need help in error

$
0
0
Hello, Your support seems offline, one of the team member said he has waited for 3 hours, and no reply from Aspose support. hope you will be able to assist further.

Here's the error details:

2015-11-06 08:32:19,284 ERROR [com.efinancialcareers.myefc.rf.processors.aspose.AsposeResumeConverterProcessor] - Unexpected exception {}
java.lang.NullPointerException
 at com.aspose.pdf.internal.p48.z29.m27(Unknown Source)
 at com.aspose.pdf.internal.p37.z1.m1(Unknown Source)
 at com.aspose.pdf.internal.p37.z5.m1(Unknown Source)
 at com.aspose.pdf.internal.p27.z7.m3(Unknown Source)
 at com.aspose.pdf.internal.p27.z7.m4(Unknown Source)
 at com.aspose.pdf.internal.p27.z7.m2(Unknown Source)
 at com.aspose.pdf.internal.p27.z7.m2(Unknown Source)
 at com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)
 at com.aspose.pdf.z37.m1(Unknown Source)
 at com.aspose.pdf.ADocument.save(Unknown Source)
 at com.aspose.pdf.Document.save(Unknown Source)
 at com.aspose.pdf.ADocument.save(Unknown Source)
 at com.aspose.pdf.Document.save(Unknown Source)
 at com.efinancialcareers.myefc.rp.aspose.converters.PdfAsposeConverterImpl.toHtml(PdfAsposeConverterImpl.java:108)
 at com.efinancialcareers.myefc.rp.aspose.AsposeResumeConverterServiceImpl.convertToHtml(AsposeResumeConverterServiceImpl.java:28)
 at com.efinancialcareers.myefc.rf.processors.aspose.AsposeResumeConverterAdapterImpl.convertToHtml(AsposeResumeConverterAdapterImpl.java:24)
 at com.efinancialcareers.myefc.rf.processors.aspose.AsposeResumeConverterProcessor.process(AsposeResumeConverterProcessor.java:60)
 at com.efinancialcareers.myefc.rf.BaseResumeProcessor$2.call(BaseResumeProcessor.java:344)
 at com.efinancialcareers.myefc.rf.BaseResumeProcessor$2.call(BaseResumeProcessor.java:335)
 at com.efinancialcareers.myefc.rf.BaseResumeProcessor.runInTransaction(BaseResumeProcessor.java:319)
 at com.efinancialcareers.myefc.rf.BaseResumeProcessor.processInsideTransaction(BaseResumeProcessor.java:335)
 at com.efinancialcareers.myefc.rf.BaseResumeProcessor.processMessage(BaseResumeProcessor.java:149)
 at com.efinancialcareers.myefc.rf.BaseResumeProcessor.onMessage(BaseResumeProcessor.java:94)
 at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:330)
 at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:537)
 at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:497)
 at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
 at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
 at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)
 at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1096)
 at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1088)
 at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:985)
 at java.lang.Thread.run(Thread.java:745)
 
This message was posted using Banckle Live Chat 2 Forum

SVG Support in data URL?

$
0
0
May I know if Aspose supports SVG while passing through DataURL?

I am trying to convert HTML to PDF. It has two images, one PNG file and the other a SVG both passed as base 64 Data URL to the background colour.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
</style>
</head>
<body>
    
<div class="node" style='background: url

("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAATHElEQVR4Xu2dCbA1RXmGH2VxQVRShZSiorK4RQ1aCioYQINg

INEoUipuIQUuAaNgFBUNglKCBE00KQFDCJIEUmIQF1xwAUTcICIimygqIiqpUnAPmHr//5t7z3/PNjNnZk7P9NtVp84Pd6b766f7PTO9fd

+dcDIBE5hK4E5m0xmBuwKbx+ceM75l0G3ArTO

+9bdfd2Z5xgVZIM02/kbADsD28a1/F58rgUfP6fgShtIsAUlklwMPB64Bro1v/bv43NFstfLNzQKp3/Z3AXYDdo6PhLDNjE57U/2iJt55vxli/E4I5xLgi8D

ngN82XH4W2Vkg5Zt5E2D3EIWE8djoeOcBV4Uwri+fXatXbhtPMT1l9gqbvxr2SiyfBf6vVQsGkrkFMrshdx3pYI

+PjqUOpo9+mfuUnjQibgn9S1GPTwAX9qkiXdpqgYzT3hF4AXAA8N/A96IjXdxlw3RQ1pNDMHot3Ac4Iz7/00HZvSnCAlnfVOokhSg0O6TO8gHg5t605GKG3j

fqLwZ6lSzEoh

+HrFPOAtkMeGE8Ke4/IopvZd0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keO3SyTN5mT82Dtt021XyKu3pwBHAD4E31Qm1nDKuIQqk4L17NJwinEooH0y5IXpo237B98fBV1O4g0tDFkjRWAr

oo184eeCTUPQa4FSfwIHB89LgeVn9rNK/MweBFK2gYKMSikJzSSjvTr95krLw1cFPh5jET/HHB59yEkjRmBqbSCiPCM98H4gV3sE3do0K6jVVOxceGD6WJQx

NqWeTchRI0bh3iVh2B8R6yhmAxPKNbFp/ckUfE6KQMK4GCi5JndPoqo1yFsgo462jU0gsSkWnuLGrhlhyOQ8YEcXtUX8x0MxU1skCGW/

+R42IRfEWvx8nGy8YWE/R3qjdAIljzxFRKFyFUxCwQGZ3BXlZUedRR9oV0ClHBQXSR6cd

+5S0kKd66KOxhaZlVQ953dcRZ6cJBCyQ8t1CrNSxik4mLyzqYOcBVwHXxKd8ju1cKTt3ADRr9/A4kSmbLxoRt4TuVIKABVIC0pRLNgqx7Azoo06pz7XxKQRT

fOtVrcmkmaVCCEXZ+pbbJJUpOxTcUk8HCfmOJgvPJS8LpPmW1i+3PqOdVv/WuoEWK3XQq/jctua/i0NgCqG99iO3OMX/

+/oaIYyK8brmq5RvjhZId22/yZxOX3R+WTQqokli+hmg2SanlglYIC0Ddvb9JvD/qhDo572muEUAAAAASUVORK5CYII=") no-repeat yellow; width: 

300px; height: 200px;'>
        <div>Some text</div>
    </div>

    <div class="node" style='background: url

("data:image/svg

+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJo

dHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgIHdpZHRoPSIzMDBweCIgaGVpZ2h0PSIzMDBweCIgdmlld0JveD0iMCAwIDMw

MCAzMDAiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDMwMCAzMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUi

PjxjaXJjbGUgY2xhc3M9Im15Y2lyY2xlIiBmaWxsPSIjRUQxRjI0IiBjeD0iMTUwIiBjeT0iMTUwIiByPSIxNTAiLz48L3N2Zz4=") no-repeat; width: 

300px; height: 300px;'>
        <div>Some text</div>
    </div>

    <div class="node nodeSVG" style='background: url

("data:image/svg

+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJo

dHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgIHdpZHRoPSIzMDBweCIgaGVpZ2h0PSIyMDBweCIgdmlld0JveD0iMCAwIDMw

MCAyMDAiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDMwMCAyMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUi

PjxlbGxpcHNlIGNsYXNzPSJteWNpcmNsZSIgZmlsbD0iI0VEMUYyNCIgY3g9IjE1MCIgY3k9IjEwMCIgcng9IjE1MCIgcnk9IjEwMCIvPjwvc3ZnPg==") 

no-repeat; width: 300px; height: 200px;'>
        <div>Some text 111111111111111111222222222222 3333333333333333 

44444444444</div>
        
    </div>
      


</body>
</html>

Neither of the 2 methods, I tried converting html to pdf gave me correct result.
Method 1
 private static void GeneratePDFHtmlLoadInputFile(string inputFile, string outputFile)
        {
            HtmlLoadOptions htmloptions = new HtmlLoadOptions(Directory.GetDirectoryRoot(inputFile));
            
            Document doc = new Document(inputFile, htmloptions);
            doc.Save(outputFile);
        }

Method 2
        private static void GeneratePDFSection(string inputFile, string outputFile)
        {
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            // instantiate Section object
            Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
            // set the margin for section object
            section.PageInfo.Margin.Top = 0;
            section.PageInfo.Margin.Left = 0;
            // set the page width information for section object
            section.PageInfo.PageWidth = 1000F;
            // set the page Height information for section object
            section.PageInfo.PageHeight = 800F;
            // adjust font automatically
            pdf.IsAutoFontAdjusted = true;
            // Read the contents of HTML file into StreamReader object
            StreamReader r = File.OpenText(inputFile);
            // instantiate Text object with HTML file contents
            Aspose.Pdf.Generator.Text text = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());
            // set the section orientation as Landscape
            section.IsLandscape = true;
            text.IsFitToPage = true;
            text.IsHtmlTagSupported = true;
            text.IfHtmlTagSupportedOverwriteHtmlFontNames = true;
            text.IfHtmlTagSupportedOverwriteHtmlFontSizes = true;
            section.Paragraphs.Add(text);
            pdf.Save(outputFile);
        }

not seeing images in pdf using https

$
0
0
We have recently tried to update our website to use HTTPS and discovered that the pdf created no longer shows images. Whilst it still works if we change our web server back to HTTP we cannot understand why.

We have also tried to update aspode.pdf to version 11 but this has made no difference.

I have attached for your reference three files: as follows:

Index.cshtm - razor view page (please see line 203, 386, and 390

ReportImage.cs - static class to retrieve url for image at runtime

ImageController.cs - mvc controller which process the request for the image from the url

An error occurred while processing paragraphs

$
0
0
Following is the code, and the attached image is error detail.

Page page = document.Pages.Add();
            var builder = new StringBuilder();
            builder.Append("<div style='width:400px;border:1px solid red;word-break:break-all;'>");
            for (int i = 0; i < 10000; i++)
            {
                builder.Append("A");
            }
            builder.Append("</div>");
            var html = new HtmlFragment(builder.ToString());
            page.Paragraphs.Add(html);

The performance for HtmlFragment

$
0
0
Hi

    Our code uses a lot of HtmlFragment objects in pdf file. We found that the export PDF for a long time.My test code is as follows:
var html = new HtmlFragment("<div>aaa</div>");
                for (int i = 0; i < 100; i++)
                {
                    page.Paragraphs.Add(html);
                }

    PDF generation time is 40 seconds,We can improve the efficiency of here?Expect your reply.

Determining which field to flatten when they overlap

$
0
0
In the attached file "Original Form.pdf", there are some overlapping fields. The field named "TheCorp" is a multi-line text box field that is almost completely covered by 120 smaller text box fields named "b1.N" where N is a number from 0 to 119. The multi-line text box field "TheField" and the 120 text box fields named "d1.N" are similar. The text in the multi-line fields is replicated in the single-line fields. When you edit the text, you see the multi-line field so it looks like a normal text editor. When not editing the text, you see the smaller single-line fields so it looks like the text is broken out letter by letter.

We're trying to flatten the fields so that it will appear the same as when you use Acrobat's sanitize function. I've attached two documents that show my current results for that. For the one called "Aspose Flattened Form.pdf", I simply flattened all of the fields using the Flatten method of the Aspose.PDF.Document object. If you look at the two documents, you'll notice that Acrobat did not flatten the multi-line text boxes, leaving only the single line text boxes; whereas flattening using Aspose flattened both, so you end up with overlapping text.

Another part of the Acrobat sanitize function removes content hidden behind overlapping objects, so perhaps it removed the multi-line text boxes before flattening the fields, but the multi-line text boxes are not completely hidden - the top and bottom edges of the "TheCorp" field are not overlapped, and the bottom edge of the "TheField" field is also not overlapped. There's very little visible, but it's still something.

My question is do you have any suggestions for programmatically determining that the multi-line text boxes won't be visible and hence should be removed and not flattened? The other properties I've checked on the fields don't seem to help - the best I've found are the Flags property of the association Annotation object for the field, but that just includes the "Print" flag for both the multi-line and the single-line text boxes (the multi-line text doesn't get printed, either, despite the flag being set), so there's no difference I can use there. Any ideas at all on how to duplicate Acrobat's behavior using Aspose.PDF would be very appreciated.

Thanks,
Michael Whalen

Rotate and merge

$
0
0
Hi,

I try to rotate Page 1 from document A and move that page as page 1 to document B. Document B has to be created on the fly. The rotation itself works as well as the merge of the page to a new document. The problem is, that the remaining page 2 of Document A is rotated instead of the moved page 1 in document B:

Document doc1 = new Document("foo.pdf");
PdfPageEditor pdfPageEditor = new PdfPageEditor(doc1);
Map<Integer, Integer> rotations = new HashMap<>();
rotations.put(1, 90);
pdfPageEditor.setPageRotations(rotations);
pdfPageEditor.save("foo.pdf");

Document doc2 = new Document();
Page pageToMove = doc1.getPages().get_Item(1);
doc2.getPages().insert(1, pageToMove);
doc1.getPages().delete(1);
doc1.save("foo.pdf");
doc2.save("bar.pdf");

Am I missing something?

Converting PDF to DOCX, taking too much time and loosing spaces in between text

$
0
0
Hi,

I am trying to convert a PDF to DOCX

Input PDF Attributes:
1. 2.7 MB file
2. 444 pages
3. Content is mostly text except for a barcode at the end.

Code Snippet:
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(getCurrentWorkingDirPath()+"\\files\\performance\\pdf2doc\\TEST_2MB_FILE.pdf");
pdfDocument.save(getCurrentWorkingDirPath()+"\\files\\performance\\pdf2doc\\sample2MB.docx",com.aspose.pdf.SaveFormat.DocX);

JVM Memory Settings:
-Xmx1024m -Xms256m

System:
Intel i5-4570, 3.2 GHZ
4 GB RAM
64 bit OS

Aspose Details:
Evaluation version of Aspose Total
aspose pdf 10.9.0.jar

My questions:
1. Is the above code correct or is there a way use your API differently to convert pdf to docx ?

2. The output DOCX contains text without spaces. Why are spaces missing in the output ?
      String from the input pdf file : View and edit work item properties
      String from output docx file : Viewandeditworkitemproperties

3. Time taken for this conversion is 294 seconds. Is there a way to optimize time taken for conversion ?

Bad Effect of Pdf Convertion

Viewing all 1038 articles
Browse latest View live