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

Load PDF and render it on Canvas/JPanel. A package is missing.

$
0
0
I am working on a project to load files with different formats and display them on a Java component, such as Canvas, JPanel, or JavaFX panes. I can use Aspose.Words to load DOCX, XML, TXT, HTML with Document's constructor and render them with the Document.renderToScale() or renderToSize() method.
I was trying to do the same for PDF with Aspose.Pdf. After checking the JavaDoc it seems PdfDocument can do this. However, I have two issues:
1. I have not found any method that can render a PDF, like what Aspose.Words does. What class can do this?
2. The aspose-pdf-jdk16.jar does not have the com.aspose.pdf.engine package. So PdfDocument class dose not exist and I could not even test if any PDF file can be loaded with PdfDocument class.
Best regards, Martin

Aspose.PDF exports corrupted graphics files, trial version

$
0
0
I just tried the code out, and I can read in DOCX files and output them to PDF/TIFF/JPEG without issue. But when I read in a PDF file, and try to output DOCX/TIFF/JPEG, only the DOCX file works. The TIFF and JPEG files are corrupted and cannot be opened. Is there a glitch in the demo, or am I missing something? Thankyou in advance.

Aspose.Pdf.Document d2 = new Aspose.Pdf.Document(@"C:\1\SomeLayout.pdf");
d2.Save(@"C:\1\test0.docx", Aspose.Pdf.SaveFormat.DocX); <--Works
d2.Save(@"C:\1\test0.tiff");  <--Creates corrupt file
d2.Save(@"C:\1\test0.jpeg");  <--Creates corrupt file

Aspose.Words.Document d4 = new Aspose.Words.Document(@"C:\1\mydoc.docx");
d4.Save(@"C:\1\test2.pdf", Aspose.Words.SaveFormat.Pdf);  <--Works
d4.Save(@"C:\1\test2.tiff");  <--Works
d4.Save(@"C:\1\test2.jpeg");  <--Works

TextAbsorber with Rectangle generates incomprehensible failure

$
0
0
I am reading a PDF page by page but on page 69 of the PDF attachment that generates an error message "Index was outside the bounds of the array" occurs. 

This does not make sense that an error occurs only on page 69 and not in others, because the coordinates of the rectangle are the same as always.

Below is a snippet of code reading:

for (int page = PaginaInicial; page <= PaginaFinal; page++)
{
   TextAbsorber textAbsorber = new TextAbsorber();
    textAbsorber.TextSearchOptions.LimitToPageBounds = true;
    textAbsorber.TextSearchOptions.Rectangle = new Aspose.Pdf.Rectangle(0, 0, 300, 500);
    pdfDocument.Pages[page].Accept(textAbsorber); //<=== ERROR IN PAGE nr. 69
    pg += textAbsorber.Text;
}

Changing Pdf's Producer field

$
0
0
Hello,
I'm trying to change pdf's "Producer" field, by:

PdfFileInfo fileInfo = new PdfFileInfo("myPdf.df");
fileInfo.Producer = "blabla";
fileInfo.SaveNewInfo("myNewPdf.pdf");

But then I get error that Aspose.Pdf.Facades.PdfFileInfo.Producer is read only.
How can I change this field?
Thanks,
Roi

Fastest way to extract entire content of PDF file as Single String

$
0
0

Hi Team,

I am having a huge pdf file (almost 60 pages) and I want to extract the entire content of the PDF as single string .I know I can use TextAbsorber,TextDevice and PdfExtractor but I want to know which is the fastest way to use for a large file. Please advice.

Thanks ,

Karthikeyan N.S.

optimize combined pdfs

$
0
0

Dear ladies and gentlemen,

 

in our application we combine several pdf-files to one single file. Those pdf-files (PDF/A-1b) were created with Aspose.Words out of a

MS-Word document. Each of those files contains the needed fonts. It seems that in the joined pdf the fonts exists multiple times.

To reduce the size of the file, we would like to have the fonts one-time. Is there a possibility to get that? If it is so,

how can we do it?

 

 

Best regards,

Oliver

Convert images file into searchable pdf in .net

$
0
0
Hi

  I am convert all images file to pdf file,but i need some more facility,like images have some words,so after convert images to pdf file,i need to search the word form pdf,but currently not show any result.
Note: in .Net ,search word in output pdf file 

Pls provide sample code.here i attach sample image file convert as pdf file


pls reply asap
  Regards
      Aravind

How do you stop words from being split across two lines

$
0
0
Dear Team

We have an issue in using Aspose.pdf. We need to convert HTML to PDF. The issue is words are getting split to next lines. Attaching the code & sample output for reference. Please help

Code

 

Dim pdf As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf()

 

                       'set the license file

                       Dim lic AsNew Aspose.Pdf.License()

                        lic.SetLicense(System.Web.HttpContext.Current.Server.MapPath("AsposeLicense/Aspose.Total.lic"))

 

                       ' add the section to PDF document sections collection

                       Dim section As Aspose.Pdf.Generator.Section = pdf.Sections.Add()

 

                        section.PageInfo.PageWidth = Aspose.Pdf.Generator.PageSize.LetterWidth

                        section.PageInfo.PageHeight = Aspose.Pdf.Generator.PageSize.LetterHeight

 

 

 

                       Dim marginInfo As Aspose.Pdf.Generator.MarginInfo = New Aspose.Pdf.Generator.MarginInfo()

                        marginInfo.Top = 0

                        marginInfo.Bottom = 0

                       marginInfo.Left = 0

                        marginInfo.Right = 0

 

                       Dim marginInfotext As Aspose.Pdf.Generator.MarginInfo = New Aspose.Pdf.Generator.MarginInfo()

                        marginInfotext.Top = 95

                        marginInfotext.Bottom = 95

                        marginInfotext.Left = 35

                        marginInfotext.Right = 35

 

                        section.PageInfo.Margin = marginInfotext

 

                       Dim txt1 As Aspose.Pdf.Text.TextFragment = New Aspose.Pdf.Text.TextFragment()

                        txt1.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Justify

 

                       Dim graph1 As Aspose.Pdf.Generator.Graph = New Aspose.Pdf.Generator.Graph(section)

                        graph1.Margin.Top = 0

                        graph1.Margin.Bottom = 0

                        section.Paragraphs.Add(graph1)

                                             

                        Dim text As Aspose.Pdf.Generator.Text = New Aspose.Pdf.Generator.Text(section, sHtml)

                       

 

                        text.IsHtmlTagSupported = True

 

                        section.Paragraphs.Add(text)

                        section.IsSpaced = True

 

                       'set page size

                        pdf.PageSetup.PageWidth = Aspose.Pdf.Generator.PageSize.LetterWidth

                        pdf.PageSetup.PageHeight = Aspose.Pdf.Generator.PageSize.LetterHeight

 

                       

                        pdf.PageSetup.Margin = marginInfo

 

                        pdf.Save(sTempPDF)

 

 

HTML Source sHtml =

 

<html><body><table cellspacing="2.50cm" width="100%"><tbody><tr><td><p></p><p><br /></p><p style="margin-top: 0px;margin-bottom: 0px;">1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;is&nbsp;an&nbsp;example&nbsp;of&nbsp;a&nbsp;decision,&nbsp;including&nbsp;special&nbsp;characters&nbsp;like&nbsp;"ô"&nbsp;and&nbsp;"í"&nbsp;and&nbsp;"ã"&nbsp;and&nbsp;other&nbsp;features&nbsp;(like&nbsp;parentheses)&nbsp;and&nbsp;a&nbsp;noun's&nbsp;possessive&nbsp;forms.&nbsp;--</p><p><br /></p><p style="margin-left: 0.5in;margin-top: 0px;margin-bottom: 0px">a.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Some&nbsp;parts&nbsp;of&nbsp;the&nbsp;text&nbsp;will&nbsp;need&nbsp;to&nbsp;be&nbsp;indented.</p><p><br /></p><p style="margin-left: 1in;margin-top: 0px;margin-bottom: 0px">i).&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;some,&nbsp;even&nbsp;further;</p><p><br /></p><p style="margin-top: 0px;margin-bottom: 0px;">2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;All&nbsp;paragraphs&nbsp;will&nbsp;also&nbsp;need&nbsp;a&nbsp;tab&nbsp;character&nbsp;between&nbsp;the&nbsp;number&nbsp;and&nbsp;text,&nbsp;which&nbsp;transfers&nbsp;to&nbsp;the&nbsp;IR&nbsp;intact,&nbsp;and&nbsp;paragraph&nbsp;breaks&nbsp;between&nbsp;each.</p><p></p><p><br /></p><p></p><p><br /></p></td></tr></tbody></table></body></html>

Thanks
Anish

Problem with license

$
0
0
We are using an older version. I've just downloaded latest version and I get this exception: {"The subscription included in this license allows free upgrades until 20 Sep 2013, but this version of the product was released on 07 Jul 2014. Please renew the subscription or use a previous version of the product."} We will renew the subscription but I would like to have this as a trial to test an issue. How can I get a trial license? Thank you!

Demo limitations

$
0
0
I am evaluating Aspose.PDF and sometimes it only extracts the first line and other times it is only extracts part of the first line.  

Is this a limitation of the demo version?  How can I test this product before purchasing it to prove it can handle our varied and very large documents.

The reason I ask is that just last week I purchased another product that worked fine in test on a 32- bit machine but failed to work on the 64-bit servers.  I cannot afford to recommend another dud to my client.

Thanks.

Here is the code.  Debug shows that the memoryStream is huge but the extractedText is tiny.

                            Document pdfDocument = new Document(memoryStream);
                            TextAbsorber textAbsorber = new TextAbsorber();
                            pdfDocument.Pages.Accept(textAbsorber);
                            string extractedText = textAbsorber.Text;

Absorber - How to get the rows without spaces (formatting) left?

$
0
0
Hello I am using Aspose.Pdf (9.4.0) and after using the command "pdfDocument.Pages [page] Accept (textAbsorber);"
I get the rows from the page with their respective spaces at the beginning of each line. 

Is there any parameter to automatically remove this "formatting" of spaces at the beginning of each paragraph? 

The code snippet that I use is this (page 1 of attachment): 
for (int page = PaginaInicial; page <= PaginaFinal; page++)
{
textAbsorber = new TextAbsorber();
textAbsorber.TextSearchOptions.LimitToPageBounds = true;
textAbsorber.TextSearchOptions.Rectangle = new Aspose.Pdf.Rectangle(0, 20, 300, 672);
pdfDocument.Pages[page].Accept(textAbsorber);
linha = textAbsorber.Text;
}

Following figure for clarity.

Non-trappable error

$
0
0
The following outputs an error on the jpegdevice.process command.

java.lang.ArrayIndexOutOfBoundsException: 3
java.lang.ArrayIndexOutOfBoundsException: 3

Can I trap this? it just spits out error to standard output.

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(pd.finalprodpath);
                    com.aspose.pdf.Document pdf = new com.aspose.pdf.Document();
                        
                        
                        String base = "";
                        for (int pageCount = 1; pageCount <= pdfDocument.getPages().size(); pageCount++)
                        {
                            Page ppage = pdf.getPages().add();
                            Page spage = pdfDocument.getPages().get_Item(pageCount);
                            
                            String pend = String.valueOf(pd.stampstart + (pageCount-1));
                            String newbase = pd.rootname.substring(0,pd.rootname.length() - pend.length());
                            String subbase = pd.tiffpath + pd.rootname + slash;
                            File subfile = new File(subbase);
                            if(!subfile.isDirectory())
                                subfile.mkdir();
                            String stamp = newbase + pend;
                            String outpath = subbase + stamp + "."  + ext;
                            if(pageCount==1)
                                base = subbase + stamp + ".pdf";
                            ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
  Resolution resolution = new Resolution(300);
                            
                            JpegDevice jpegDevice = new JpegDevice(resolution,60);
    //  THE LINE BELOW CAUSES ERROR
                            jpegDevice.process(pdfDocument.getPages().get_Item(pageCount), imageStream);
                            byte[] data = imageStream.toByteArray();
                            ByteArrayInputStream bois = new ByteArrayInputStream(data);
                            com.aspose.pdf.Rectangle rect = spage.getMediaBox();
                            ppage.setMediaBox(rect);
                            ppage.addImage(bois, rect);
                            
                    
                        }
                        pdf.convert("error.log", PdfFormat.v_1_4, ConvertErrorAction.None);
                        pdf.save(base);
                }
                          

PDF resaved to PDF/A-1b results in background of page 1 image in dark blue

$
0
0
We are using your toolkit to remove metadata from PDFs and/or change the PDF to a Secure PDF or PDF/A.  One of our clients had a document, that unfortunately I do not have permission to submit, where processing into a PDF/A altered background image of a text box on the first page.  Processing this file to just remove metadata or output as a Secure PDF did not alter the PDF.  Only output to PDF/A is the problem.

I'm unable to export our client's sample PDF to a PDF/A from within Adobe Acrobat Pro 9.  Running their Preflight Profile for a PDF/A-1b finds errors so I'm wondering if the Adobe's inability to create the PDF/A is related to Aspose producing this anomaly.

First question:  Do PDF/A produced by Aspose pass "Verify Conformance" run from Adobe?  It appears many I've been testing do not.  I'm not sure how important Adobe's "conformance" is for courts that require submission of PDF/A documents.

Second question:  The resulting PDF/A is coming out 4 times as large as the original.  Is there a way to compress?

Thanks,
Kristen

PDF conversion - reference version 1.7

$
0
0
Hello, i'm searching for this information: Aspose PDF conversion - from every kind of Aspose supported original files, doing instruction document.save(pdf-file) generates PDF files compatible with Adobe PDF reference version 1.7 ?

Thank's

Printg a PDF from an ASP.NET Web Page

$
0
0

I am researching your product and I want to know if your product can print a PDF from a ASP.NET web page to the client's Printer. The  PDF should not show and print automatically. We have PDFs stored in our Database. Our application will allow the user to click on a PDF title. The application will open up the database and stream the pdf data to the printer. I will also batch up requests and send more than one PDF to the printer from the Web page. Note: I am not talking about printing the ASP webpage in PDF format.

 

Thanks

DLR


Issue with PDFSignature.verifySignature method for Aspose pdf for Java

$
0
0
Hi,

I am trying to verify that a pdf is signed with the correct signature using Aspose 9.3.0. I am using the following code but the verifySignature does not works.

PdfFileSignature pdfSign = new PdfFileSignature();
        pdfSign.bindPdf(fileName);

        boolean isSignatureOk = false;

        if(pdfSign.isContainSignature()) {
            for(Object sn : pdfSign.getSignNames()) {
                String sv = (String) sn;
                String signerName = pdfSign.getSignerName(sv);
                System.out.println("Signer Name = " + signerName);
               
                if(pdfSign.verifySignature(sv)) {
//perform some code
}else{
System.out.println("Signature: "+sv+" invalid");
}

The verifySignature always goes to the else statement saying it is invalid. The same method works fine with PDF kit for Java. Is there any issue in the current version of Aspose.If there is any workaround, can you please help me with that.

Thanks
Rajeev

If the Bookmarks is not exist, Export Bookmarks To XML ( The error occurred)

$
0
0
 How to decide whether there really are bookmark involved?

 Document pdfDocument = new Document(ABC.pdf);//ABC.pdf does not contain bookmarks .

 if (pdfDocument.Outlines.Count>0 || pdfDocument.Outlines.First.Count > 0)//Outlines.Count | 1
   {
       try        
       {
              Aspose.Pdf.Facades.PdfBookmarkEditor bookmarkEditor = new Aspose.Pdf.Facades.PdfBookmarkEditor();
                           
             bookmarkEditor.BindPdf(pdfDocument);
              //Export bookmarks
                  
              bookmarkEditor.ExportBookmarksToXML(sOutpathFile);//The error occurred
                               
              }

              catch (Exception ex)
               {
                     MessageBox.Show(ex.Message); 
               }
}
else
{
//
......
}

Creating a PDF doc from xml and xlst file pair.

$
0
0

Hi.My namae is cemil karapinar.I started to evaluate Aspose.Pdf .for .net. product.

When I used BindXML method it waited indefinetly resulting error "The remote server returned an error: (500) Internal Server Error."

I could not understand why it needs to connect a remote server?

My code is as following.


Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            pdf.BindXML(@"D:\source.xml", @"D:\source.xslt");
            pdf.Save(@"D:\target.pdf");

Could you help me Why I failed?

How to identify the amount of columns of a page / file?

$
0
0
I'm trying to read a PDF with Aspose.Pdf (9.4.0) using the method Absorber. 
The problem is that the pages / files have different amount of columns! 

How is it possible to discover the amount of columns to be able to mount the coordinates of the rectangle to the method absorber? 

Following image and 2 PDFs with 2:04 columns. 

In the code snippet that I am using I need to know the number of columns to properly define the areas of the rectangle to extract the absorber.

iPosColInit = 10;
iPosColEnd=155
textAbsorber = new TextAbsorber();
textAbsorber.TextSearchOptions.LimitToPageBounds = true;
textAbsorber.TextSearchOptions.Rectangle = new Aspose.Pdf.Rectangle(0,iPosColInit , iPosColEnd, 700);
pdfDocument.Pages[1].Accept(textAbsorber);                     
linha = textAbsorber.Text;

Att,

TextDevice methods are changing the text position.

$
0
0
I was using Aspose.Pdf (9.4.0) with the method Absorber and when I started using the class textDevice the "footer" of the PDF has become returned in the string before the "header". 

Why this is happening? Attached the file and image .

The following code snippet: 

textDevice:
using (MemoryStream textStream = new MemoryStream())
{
  textDevice = new TextDevice();
  Aspose.Pdf.Text.TextOptions.TextExtractionOptions textExtOptions = new Aspose.Pdf.Text.TextOptions.TextExtractionOptions(Aspose.Pdf.Text.TextOptions.TextExtractionOptions.TextFormattingMode.Raw);
   textDevice.ExtractionOptions = textExtOptions;
   textDevice.Process(pdfDocument.Pages[page], textStream);                       
   textStream.Close();
   linha = Encoding.Unicode.GetString(textStream.ToArray());
}

TextAbsorber:
textAbsorber = new TextAbsorber();
pdfDocument.Pages[page].Accept(textAbsorber);
linha = textAbsorber.Text;


Att,
Viewing all 3131 articles
Browse latest View live