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

Aspose.Pdf for ZUGFeRD attachments

$
0
0
Hello,

I am evaluating Aspose.Pdf to see if it can be used to generate ZUGFeRD-compatible PDFs.

ZUGFeRD is a German standard for electronic invoices. Basically you attach an XML file (representing an invoice) to a PDF and add various metadata.

My questions are:

1) According to the ZUGFeRD standard, the mime type of the attachment must be set to "text/xml". There is a MIMEType field on the FileSpecification class, but whenever I try to set it I get a NullReferenceException. I am us the latest evaluation version of Aspose.Pdf.

            Document doc = new Document("in.pdf");
            Stream fs = File.OpenRead("zugferd-invoice.xml");
            FileSpecification spec = new FileSpecification(fs, "ZUGFeRD invoice in XML format");
            spec.Description = "ZUGFeRD invoice in XML format";
            spec.Name = "ZUGFeRD-invoice.xml";
            spec.Contents = fs;
            spec.MIMEType = "text/xml"; // NullReferenceException here
            doc.Save("out.pdf");

Is it possible to set the mime type with Aspose.Pdf or is this not supported?

2) It is also necessary to specify the relationship between the attached file and the PDF part in the "document dictionary". Does Aspose.Pdf have support for this? I might be using the wrong terms here since I'm not so well-acquainted with the PDF standard, but if you look at this link:

http://stackoverflow.com/questions/26036852/itextsharp-xml-zugferd-invoice-xml-attachment

What I want to know if Aspose.Pdf has some equivalent for this line:

fileSpec.Put(New PdfName("AFRelationship"), New PdfName("Alternative"))

pdf to text

Table of contents in Merged Pdf

$
0
0
Hi
http://www.aspose.com/docs/display/pdfnet/Concatenate+PDF+files+and+create+Table+Of+Contents

as reference with above link we have used with array of pdf files.
I have merged 10 pdfs and the output is displaying for 8 pdfs links only..
Please find the output for the reference.It is showing only 8 rectangles.Please give any solution for this problem.

Image alignment does not work aspose pdf 10.3

$
0
0
I am using Aspose.Pdf version 10.3. I have the code snippet below. When the pdf is rendered the image is showing left justified, and not how I have aligned the image. Please help.

var tc = TypeDescriptor.GetConverter(typeof (Bitmap));
var ms = new MemoryStream();
var bitMap = (Bitmap) tc.ConvertFrom(imgStream);
bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
ms.Position = 0;

var img = new Aspose.Pdf.Image();
img.ImageStream = ms; //bitmap memory stream
img.HorizontalAlignment = HorizontalAlignment.Center;
var document = new Aspose.Pdf.Document();
document.Pages.Add();
document.Pages[1].Paragraphs.Add(img);

margins and image does not work together aspose 10.3

$
0
0
I have the following code snippet. When the pdf is rendered the image shows ontop of the header, and not below as it should. If I do not set the margins the pdf is rendered correctly.  Please help.

var document = new Aspose.Pdf.Document();
document.Pages.Add();
document.PageInfo.Margin = new MarginInfo(188, 188, 37, 37);
document.Pages[1].PageInfo.Margin = new MarginInfo(188, 188, 37, 37);

var htmlFragment = new HtmlFragment(htmlString);
var header = new Aspose.Pdf.HeaderFooter();
header.Paragraphs.Add(htmlFragment);
document.Pages[1].Header = header;
 
var img = new Aspose.Pdf.Image();
img.ImageStream = ms; //get image from memory stream
img.HorizontalAlignment = HorizontalAlignment.Center;
document.Pages[1].Paragraphs.Add(img);

Alternative to WrapLines

$
0
0
Hi,

In process to move from Aspose.Pdf.Generator to Aspose.Pdf I need to Move from Text to TextFragment. I am not sure how i can wrap lines in TextFragment.

Please share some example of Aspose.Pdf.Document for wrapped lines.

Regards,
Sandeep

Aspose.Publisher for .NET

$
0
0
Hi,

is it possible to save PDF and HTML out of Microsoft Publisher (Extension .pub) with one of your products?

Aspose PDF License related

$
0
0
Hi We use Aspose PDF 7.4.0.0 dll and Aspose Barcode (.NET) . Sometime we have seen watermarks on the PDF even when the licenses are loaded properly. Is it because too many processes are accessing the license simultaneously ?

Following is the sample code we use :-

string tempFile = @"C:\Temp\barcode.jpg"
string inpdfFile = "@"C:\Temp\input.pdf"
string outpdfFile= "@"C:\Temp\output.pdf"


Aspose.Pdf.License _AsposeLicense = new Aspose.Pdf.License();
 _AsposeLicense.SetLicense("Aspose.Pdf.lic");
Aspose.BarCode.License _AsposeBarCodeLicense = new Aspose.BarCode.License();
_AsposeBarCodeLicense.SetLicense("Aspose.BarCode.lic");


BarCodeBuilder bb = CreateBarcodeObject("012345678901");
 bb.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);
 barCodeImage = System.Drawing.Image.FromStream(memoryStream);
 barCodeImage.Save(tempFile, System.Drawing.Imaging.ImageFormat.Jpeg);

 mendor = new PdfFileMend(inpdfFile, outpdfFile);
mendor.AddImage(tempFile, 1, LowerX, LowerY, UpperX, UpperY);


Thanks,
Harshal


Aspose.PDF (PCL to PDF) for Java on UNIX/LINUX looks for hard-coded paths such as /usr/share/fonts/truetype/msttcorefonts/ and /usr/X11R6/lib/X11/fonts/truetype/msttcorefonts/

$
0
0
The paths for Aspose.PDF for msttcorefonts are hard-coded as /usr/share/fonts/truetype/msttcorefonts/ and/or  /usr/X11R6/lib/X11/fonts/truetype/msttcorefonts/.  There should be a way to overrided their location.

This comes up when generating PDF from PCL.

HTML results in Object Ref Not Set when saving to PDF

$
0
0
Hi

We are using Aspose.PDF.dll version 10.3.0.0.
If we convert a string variable with HTML into a PDF, we get a "object ref not set" on the document.save() command.

You can find the html and the code in the attachment.

We had problems with "bad" html before, but we can't quit figure out which html piece is wrong in this one, so we could use you're help.

Unable to run on Unix

$
0
0
I was able to generate a PDF on Windows, but when I try it on a Unix machine, I get the following error:

Exception in thread "main" java.lang.AssertionError: Cannot read a name from the name table in a font.
        at com.aspose.pdf.internal.p242.z1.m1(Unknown Source)
        at com.aspose.pdf.internal.p189.z28.m2(Unknown Source)
        at com.aspose.pdf.internal.p189.z28.m6(Unknown Source)
        at com.aspose.pdf.internal.p189.z28.m1(Unknown Source)
        at com.aspose.pdf.internal.p189.z11.m1(Unknown Source)
        at com.aspose.pdf.internal.p189.z11.<init>(Unknown Source)
        at com.aspose.pdf.internal.p189.z8.m8(Unknown Source)
        at com.aspose.pdf.internal.p189.z8.m6(Unknown Source)
        at com.aspose.pdf.internal.p189.z8.m1(Unknown Source)
        at com.aspose.pdf.internal.p189.z10.m1(Unknown Source)
        at com.aspose.pdf.internal.p189.z10.m1(Unknown Source)
        at com.aspose.pdf.internal.p189.z10.m1(Unknown Source)
        at com.aspose.pdf.internal.p414.z13.m2(Unknown Source)
        at com.aspose.pcl.composer.PDFComposer.<init>(Unknown Source)
        at aspose.pdf.Pdf.bindPCL(Unknown Source)
        at com.aspose.pdf.ADocument.m1(Unknown Source)
        at com.aspose.pdf.ADocument.<init>(Unknown Source)
        at com.aspose.pdf.Document.<init>(Unknown Source)
        at pcltopdf.Converter.generatePdf(Converter.java:123)
        at pcltopdf.Converter.main(Converter.java:74)

I looked for other questions with same problem most of them say I need to provide font for Unix, I added a TrueType font and PostScript font next to my jar file, and added the following line to my existing code

Document.addLocalFontPath(path); // path contains location of my jar file and fonts

Any help regarding my issue would be appreciated.

--Edit: Here is the complete code

/**
* Generates PDF file from the PCL and properties file and saves it in the directory found in the properties.
* @param pclFilePath canonical path of PCL file.
* @param properties contains parameters such as output directory, image path, etc...
* @return generated PDF file.
*/
private static Pdf generatePdf(String pclFilePath, Properties properties) throws IllegalArgumentException {
if(pclFilePath == null || pclFilePath.equals("")) {
throw new IllegalArgumentException("PCL file path is empty.");
}
if(properties == null || properties.isEmpty()) {
throw new IllegalArgumentException("Properties object is empty.");
}

String path = "/usr/openwin/lib/X11/fonts/TrueType";
List<String> paths = new ArrayList<String>();
paths.add("/usr/share/fonts/");
Document.setLocalFontPaths(paths);
paths.add(path);
Document.setLocalFontPaths(paths);
System.out.println("font path start");
for (int i=0; i<Document.getLocalFontPaths().size(); i++){
System.out.println(Document.getLocalFontPaths().get(i));
}
System.out.println("font path end");

// Printing the font path the Document class has stored.
System.out.println("Font Path from Document:");
for(int i = 0; i < Document.getLocalFontPaths().size(); i++) {
System.out.println(Document.getLocalFontPaths().get(i));
}
System.out.println("Finished printing Font Path");
Document doc = new Document(pclFilePath, new PclLoadOptions());
return doc;
}



--- Hello Again, below some advanced testing:
//Create PDF document
Pdf pdf1 = new Pdf();
pdf1.setTruetypeFontMapPath(path);
//Add a section into the PDF document
Section sec1 = pdf1.getSections().add();
//Add a text paragraph into the section
Text text1 = new Text("hello World -  Arial");
text1.getSegments().get_Item(0).getTextInfo().setFontName("Arial");
sec1.getParagraphs().add(text1 );
//Save the document
pdf1.save("HelloWorld.pdf");

the above code is causing exception: 
INFO: Error - Font 'Arial' not found. Please make sure the customer font file is correctly set.

NOTE: i need to solve the initial first problem, the last comment about font "Arial" not found is just a remark that i came though when testing

NOTE #2: I am having this issue on Solaris 10

PCL Line Termination in Aspose Pdf for Java is ignored

$
0
0
Aspose PDF for Java ignores PCL Line Termination sequences, such as:
PCL Line Termination

E&k0G

CR=CRLF=LFFF=FF

E&k1G

CR=CR+LFLF=LFFF=FF

E&k2G

CR=CRLF=CR+LFFF=CR+FF

E&k3G

CR=CR+LFLF=CR+LFFF=CR+FF


These sequences should alter how carriage return and line feed are interpreted by Aspose.  Instead, they are ignored.

I uploaded a sample ld.pcl file, along with two PDFs.  One shows the output from Aspose, and the other shows the intended output.  The file with the intended output also has a correction for a different problem where line drawing characters are not displayed, but that was reported as a separate issue.

PCL to PDF and special graphics characters

$
0
0
Hello, we are using aspose version 4 (aspose-pdf-jdk14.jar) to convert a pcl to pdf. The pcl file path is sent to the aspose library in order for it to make the conversion using the following line of code Document doc = new Document(pclFilePath, new PclLoadOptions());.
The issue is that the pcl file contains graphics characters that are meant to draw a table, those characters are not converted properly.

Below are the list of hex value of the characters:
"\u00c9", "\u00c8", "\u00d1", "\u00c7", "\u00c5", "\u00cf","\u00b6", "\u00bb", "\u00bc", "\u00cd", "\u00c4", "\u00ba".

I am attaching an image of the actual output and the expected output.

Awaiting your reply.

using IsVerticalBroken and VerticalTextRotationType.AntiClockWise causes formatting issue

$
0
0

Good Morning,

 

I am creating a set of tables using the PDF Generator whose cells in row1 (the headers) are set as follows:

headerCell.VerticalTextRotationAngle = VerticalTextRotationType.AntiClockWise;

headerCell.VerticalAlignment = VerticalAlignmentType.Center

headerCell.Alignment = AlignmentType.Left;

Some of these are single cells with vertical text, and some are cells with a nested table which display a name displayed vertically (ex. Time in Seat) and a set of periodicity measurements (ex.  30/60/90) displayed horizontally at the bottom.

All of the tables use the same code to generate the tables, and the first set of headers (in white) are common across all tables, with the blue and gray being added on dependent upon the Subject's requirements.  Also, the section holding all of the tables has the isLandscape option set to true.

On occasion, some of the tables extend past the page length, so I set the isVerticalBroken option for the table to true.  However, the combination of Anticlockwise and isVerticalBroken seems to throw off the formatting (see the tables for subject 0 and Subject 1).   If the table fits within the page, the formatting is fine (Subject 1), but if the table extends past the end of the page, triggering a vertical split, the formatting becomes incorrect.

Can you provide me with any advice on how to correct the problem?  Also, is there any way to repeat column1 on vertical split?  

Thank you in advance for your help in this matter.

V/R,

Cunning

 

 

 

 

 

License

$
0
0
I am constantly plagued by the "Evaluation" message. We use your product to create all sorts of documents for mfg. Labels to reports. This all runs on WCF services. I have created the method to figure out if the license is already set. Basically, create a document and check if the text contains the eval message after rendering. What you need to do is add a icense.IsLicenseSet method to your product. This has been frustrating. Please come up with a fix for this or give us instruction on how to check our app domain to see if the license is set.

PDF printing doesn't work correctly

$
0
0
Hi,

I tried to use your code sample to print a PDF, but it is printed incorrectly. Page orientation is opposite no matter whether I set AutoRotate to true or false, plus the quality is really terrible. Check the attached file and printed output. I have a single printer configured. 

//Create PdfViewer objectcom.aspose.pdf.facades.PdfViewer viewer = new com.aspose.pdf.facades.PdfViewer();//Open input PDF fileviewer.openPdfFile("input.pdf");//Set attributes for printingviewer.setAutoResize(true);         //Print the file with adjusted sizeviewer.setAutoRotate(true);         //Print the file with adjusted rotationviewer.setPrintPageDialog(false);   //Do not produce the page number dialog when printing//gets a printjob object.PrinterJob printJob = PrinterJob.getPrinterJob();//gets the default page.PageFormat pf = printJob.defaultPage();// print PDF documentviewer.printDocument();//close the Pdf file.viewer.closePdfFile();

Thanks in advance for any help.
Mariusz

Create calculated pdf form with encryption and validation.

$
0
0

I have created a pdf form in itextsharp without calculated fields. According to my search and development as well as expert advice calculated fields are not possible in itextsharp open source. 

Is It possible to do with aspose.pdf.

My basic requirement listed as,

1. Create pdf form programmatically in asp.net.

2. Provide calculated fields and validation on editable fields.

3. Provide encryption.

4. Feature to read fdf fields.

Calculated fields means i have 3 fields in pdf like Quantity, Rate and amount. quantity come from database at the time of pdf creation on that time Rate and amount column will be blank.

When user enter rate on rate column, amount column will be auto calculated(Quantity * Rate).

Validation: Rate column accept only integer value. 


If it is possible, then HOW?


Thanks


Aspose PDF (Aspose.Pdf.Document) : How do set width for cells ? I need to set different width for each cell.

$
0
0
Aspose PDF (Aspose.Pdf.Document) : How do set width for cells ? I need to set different width for each cell.

                                //Instantiate a table object

                               Table tabRprtData = newTable();

                               tabRprtData.DefaultCellTextState = RegularTextFont();

 

                               //Create MarginInfo object and set its left, bottom, right and top margins

                               Aspose.Pdf.MarginInfo margin = new Aspose.Pdf.MarginInfo();

                               margin.Top = 5f;

                               margin.Left = 5f;

                               margin.Right = 5f;

                               margin.Bottom = 5f;

 

                               tabRprtData.DefaultCellPadding = margin;

                               //Set default cell border using BorderInfo object                               

                               tabRprtData.Border = newBorderInfo(BorderSide.All, 0.1F);

 

                               //Set default cell border using BorderInfo object

                               tabRprtData.DefaultCellBorder = newBorderInfo(BorderSide.All, 0.1F);

 

                               //CREATE ROW

                               Row currentRow;

                               currentRow = tabRprtData.Rows.Add();

                               // HtmlTableCell tc;

                               Cell tc;

 

                               tc = currentRow.Cells.Add(" ");

                               tc.IsWordWrapped = true;

                              

                               tc = currentRow.Cells.Add("Distribution of Scores");

                               tc.ColSpan = 9;

                               tc = currentRow.Cells.Add("Total Institution");

                               tc.ColSpan = 3;

                               tc = currentRow.Cells.Add("Total Test Population");

                               tc.ColSpan = 3;

 

                               foreach (var itm in item.GenTestVReasonQReason)

                               {

                                   currentRow = tabRprtData.Rows.Add();

                                   tc = currentRow.Cells.Add(itm.TestType);

                                   tc = currentRow.Cells.Add(itm.ScoreRange1);

                                   tc.IsWordWrapped = true;

                                   tc = currentRow.Cells.Add(itm.ScoreRange2);

                                   tc.IsWordWrapped = true;

                                   tc = currentRow.Cells.Add(itm.ScoreRange3);

                                   tc.IsWordWrapped = true;

                                   tc = currentRow.Cells.Add(itm.ScoreRange4);

                                   tc = currentRow.Cells.Add(itm.ScoreRange5);

                                   tc = currentRow.Cells.Add(itm.ScoreRange6);

                                   tc = currentRow.Cells.Add(itm.ScoreRange7);

                                   tc = currentRow.Cells.Add(itm.ScoreRange8);

                                   tc = currentRow.Cells.Add(itm.ScoreRange9);

                                   tc = currentRow.Cells.Add(itm.TotalInst);

                                   tc = currentRow.Cells.Add(itm.MeanInst);

                                   tc = currentRow.Cells.Add(itm.SDInst);

                                   tc = currentRow.Cells.Add(itm.TotalAllTestPop);

                                   tc = currentRow.Cells.Add(itm.MeanAllTestPop);

                                   tc = currentRow.Cells.Add(itm.SDAllTestPop);                               

                               }

 

                               paragraphs.Add(tabRprtData);

Paragraphs not Keeping Indent across Pages in Html to Pdf Conversion

$
0
0
Dear Aspose,
I see many posts regarding indent not keeping across pages when converting html to pdf. It appears that this problem was fixed in earlier version. We are using version 10.3.0 and seem to still have the issue.

I have attached our sample html, the css file we are using, and a console application to run the code.

Interestingly, if you remove the css line that sets the list-style: none, the indent works correctly.

Thanks in advance for your help.
Mike

Aspose PDF Page Height for one specific page (Aspose.Pdf.Document)

$
0
0

How can I set different page height for only one page in a PDF ? [ using (Aspose.Pdf.Document)] 

In the below code snippet I’ve created 2 pages (PagecurPageAND PagechartPage) , for the second page i.e. chartPage, I need to set a height based on some custom logic. So I did create a separate PageInfopageInfo1 and set the height, but it never worked. 

But if I do set height for the first PageInfopageInfo object then it works, BUT it set that height for ALL the pages. 

My requirement is to set a specific height for only one page, i.e., Page chartPage.  Please advise or help a for a solution. 

            Document doc = newDocument();

            Aspose.Pdf.License licensePDF = new Aspose.Pdf.License();

            PageInfopageInfo = doc.PageInfo;

            Aspose.Pdf.MarginInfo marginInfo = pageInfo.Margin;

 

            marginInfo.Left = 37;

            marginInfo.Right = 37;

            marginInfo.Top = 37;

            marginInfo.Bottom = 37;           

           

            // Added page.

            Page curPage = doc.Pages.Add();

            //Add the table into the paragraphs collection of section

            Aspose.Pdf.Paragraphs paragraphs = curPage.Paragraphs;

            //Add content/data for the page

  

              // Added New page.

                Page chartPage = doc.Pages.Add();    

                // add text fragment to paragraphs collection of Page object

                chartPage.Paragraphs.Add(textSearchCriteris);

                 PageInfopageInfo1 = chartPage.PageInfo;

                pageInfo1.Height = 4000;


Thanks

Sree

Viewing all 3131 articles
Browse latest View live