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

Pdf watermark

$
0
0
hey i am using the following code for watermark of pdf


    /************************************************************************
    *
    *        Function Name : setWatermarkPdf()
    * Description : This function changes the Watermark of the pdf document
    * according to the value of the Watermark of PrintParams Object
    *
    *************************************************************************/
    static com.aspose.pdf.Document setWatermarkPdf(com.aspose.pdf.Document pdf1, String watermark)
    {
        if (!watermark.equals(""))
        {
            com.aspose.pdf.TextStamp textStamp = new com.aspose.pdf.TextStamp(watermark);
            // Giving the look of a watermark
            textStamp = WatermarkShapeSet(textStamp);
           
            // Adding the textStamp on all the pages of the pdf document
            for (int Page_counter = 1 ; Page_counter <= pdf1.getPages().size() ; Page_counter++)
            {
                pdf1.getPages().get_Item(Page_counter).addStamp(textStamp);
            }
           
        }
        return pdf1;
    }   
   
    /************************************************************************
    *
    *        Function Name : WatermarkShapeSet()
     Description : It changes the watermark related shaped accordingly to give
    * it the required look of a watermark
    *
    *************************************************************************/
    private static TextStamp WatermarkShapeSet(TextStamp textStamp)
    {
        // PdfWatermarkValues object is required to access needed constant values for constructing watermark
        PdfWatermarkValues PWV = new PdfWatermarkValues();
       
        textStamp.setBackground(true);
        textStamp.setXIndent(PWV.textStampXIndent);
        textStamp.setYIndent(PWV.textStampYIndent );
        textStamp.setRotate(com.aspose.pdf.Rotation.on90);
        new com.aspose.pdf.FontRepository();
        textStamp.getTextState().setFont(FontRepository.findFont(PWV.textStampFont));
        textStamp.getTextState().setFontSize(PWV.textStampFontSize);
        textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Bold);
        textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Italic);
        textStamp.getTextState().setForegroundColor(com.aspose.pdf.Color.getGray());
       
        return textStamp;
    }



and its giving the results attached.. the original pdf and after watermark pdf with watermark text as "Hello Dude" is attached.
Please can you help to make it look bette rlike a proper watermark, transparent grey in color placed in the middle.
Thanks

Pdf watermark

$
0
0
hey i am using the following code for watermark of pdf


    /************************************************************************
    *
    *        Function Name : setWatermarkPdf()
    * Description : This function changes the Watermark of the pdf document
    * according to the value of the Watermark of PrintParams Object
    *
    *************************************************************************/
    static com.aspose.pdf.Document setWatermarkPdf(com.aspose.pdf.Document pdf1, String watermark)
    {
        if (!watermark.equals(""))
        {
            com.aspose.pdf.TextStamp textStamp = new com.aspose.pdf.TextStamp(watermark);
            // Giving the look of a watermark
            textStamp = WatermarkShapeSet(textStamp);
           
            // Adding the textStamp on all the pages of the pdf document
            for (int Page_counter = 1 ; Page_counter <= pdf1.getPages().size() ; Page_counter++)
            {
                pdf1.getPages().get_Item(Page_counter).addStamp(textStamp);
            }
           
        }
        return pdf1;
    }   
   
    /************************************************************************
    *
    *        Function Name : WatermarkShapeSet()
     Description : It changes the watermark related shaped accordingly to give
    * it the required look of a watermark
    *
    *************************************************************************/
    private static TextStamp WatermarkShapeSet(TextStamp textStamp)
    {
        // PdfWatermarkValues object is required to access needed constant values for constructing watermark
        PdfWatermarkValues PWV = new PdfWatermarkValues();
       
        textStamp.setBackground(true);
        textStamp.setXIndent(PWV.textStampXIndent);
        textStamp.setYIndent(PWV.textStampYIndent );
        textStamp.setRotate(com.aspose.pdf.Rotation.on90);
        new com.aspose.pdf.FontRepository();
        textStamp.getTextState().setFont(FontRepository.findFont(PWV.textStampFont));
        textStamp.getTextState().setFontSize(PWV.textStampFontSize);
        textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Bold);
        textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Italic);
        textStamp.getTextState().setForegroundColor(com.aspose.pdf.Color.getGray());
       
        return textStamp;
    }



and its giving the results attached.. the original pdf and after watermark pdf with watermark text as "Hello Dude" is attached.
Please can you help to make it look better like a proper watermark, transparent grey in color placed in the middle.
Thanks

Pdf watermark

$
0
0
hey i am using the following code for watermark of pdf


    /************************************************************************
    *
    *        Function Name : setWatermarkPdf()
    * Description : This function changes the Watermark of the pdf document
    * according to the value of the Watermark of PrintParams Object
    *
    *************************************************************************/
    static com.aspose.pdf.Document setWatermarkPdf(com.aspose.pdf.Document pdf1, String watermark)
    {
        if (!watermark.equals(""))
        {
            com.aspose.pdf.TextStamp textStamp = new com.aspose.pdf.TextStamp(watermark);
            // Giving the look of a watermark
            textStamp = WatermarkShapeSet(textStamp);
           
            // Adding the textStamp on all the pages of the pdf document
            for (int Page_counter = 1 ; Page_counter <= pdf1.getPages().size() ; Page_counter++)
            {
                pdf1.getPages().get_Item(Page_counter).addStamp(textStamp);
            }
           
        }
        return pdf1;
    }   
   
    /************************************************************************
    *
    *        Function Name : WatermarkShapeSet()
     Description : It changes the watermark related shaped accordingly to give
    * it the required look of a watermark
    *
    *************************************************************************/
    private static TextStamp WatermarkShapeSet(TextStamp textStamp)
    {
        // PdfWatermarkValues object is required to access needed constant values for constructing watermark
        PdfWatermarkValues PWV = new PdfWatermarkValues();
       
        textStamp.setBackground(true);
        textStamp.setXIndent(PWV.textStampXIndent);
        textStamp.setYIndent(PWV.textStampYIndent );
        textStamp.setRotate(com.aspose.pdf.Rotation.on90);
        new com.aspose.pdf.FontRepository();
        textStamp.getTextState().setFont(FontRepository.findFont(PWV.textStampFont));
        textStamp.getTextState().setFontSize(PWV.textStampFontSize);
        textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Bold);
        textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Italic);
        textStamp.getTextState().setForegroundColor(com.aspose.pdf.Color.getGray());
       
        return textStamp;
    }



and its giving the results attached.. the original pdf and after watermark pdf with watermark text as "Hello Dude" is attached.
Please can you help to make it look better like a proper watermark, transparent grey in color placed in the middle.
Thanks

Pdf watermark problem

$
0
0
hey i am using the following code for watermark of pdf


    /************************************************************************
    *
    *        Function Name : setWatermarkPdf()
    * Description : This function changes the Watermark of the pdf document
    * according to the value of the Watermark of PrintParams Object
    *
    *************************************************************************/
    static com.aspose.pdf.Document setWatermarkPdf(com.aspose.pdf.Document pdf1, String watermark)
    {
        if (!watermark.equals(""))
        {
            com.aspose.pdf.TextStamp textStamp = new com.aspose.pdf.TextStamp(watermark);
            // Giving the look of a watermark
            textStamp = WatermarkShapeSet(textStamp);
           
            // Adding the textStamp on all the pages of the pdf document
            for (int Page_counter = 1 ; Page_counter <= pdf1.getPages().size() ; Page_counter++)
            {
                pdf1.getPages().get_Item(Page_counter).addStamp(textStamp);
            }
           
        }
        return pdf1;
    }   
   
    /************************************************************************
    *
    *        Function Name : WatermarkShapeSet()
     Description : It changes the watermark related shaped accordingly to give
    * it the required look of a watermark
    *
    *************************************************************************/
    private static TextStamp WatermarkShapeSet(TextStamp textStamp)
    {
        // PdfWatermarkValues object is required to access needed constant values for constructing watermark
        PdfWatermarkValues PWV = new PdfWatermarkValues();
       
        textStamp.setBackground(true);
        textStamp.setXIndent(PWV.textStampXIndent);
        textStamp.setYIndent(PWV.textStampYIndent );
        textStamp.setRotate(com.aspose.pdf.Rotation.on90);
        new com.aspose.pdf.FontRepository();
        textStamp.getTextState().setFont(FontRepository.findFont(PWV.textStampFont));
        textStamp.getTextState().setFontSize(PWV.textStampFontSize);
        textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Bold);
        textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Italic);
        textStamp.getTextState().setForegroundColor(com.aspose.pdf.Color.getGray());
       
        return textStamp;
    }



and its giving the results attached.. the original pdf and after watermark pdf with watermark text as "Hello Dude" is attached.
Please can you help to make it look better like a proper watermark, transparent grey in color placed in the middle.
Thanks

HTML-to-PDF inline - major problems with form layout

$
0
0
We're currently evaluating this tool for purchase, and I've been running into a number of problems getting the output to match the source material. I've attached a ZIP file containing both the HTML source and the resulting PDF. If you view the HTML file in a web browser (IE, firefox, etc.) and then compare it to the PDF, the difference is significant.

  • field values overlapping on top of other cells/elements in the same row
  • half of the fields appear to be missing (off-page or hidden underneath other elements)
  • "border-radius" CSS style not working?
  • "text-align: left" CSS style not working in audit history TH classes
  • other minor spacing issues, like how "Demographics" and "Single-Line Entry" are right up against each other -- in other tests I ran, they were so close that the solid border between them was hidden entirely.

Could someone please check and see what might be causing these problems? My conversion code closely follows the InLineHTML example:
var pdf = new Aspose.Pdf.Generator.Pdf();
pdf.IsLandscape = true;
pdf.Security = new Aspose.Pdf.Generator.Security();
pdf.Security.IsFormFillingAllowed = false;

var section = pdf.Sections.Add();

StreamReader r = File.OpenText(@"C:/test/input3.html");

var text = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());
text.IsHtmlTagSupported = true;

section.Paragraphs.Add(text);
            
pdf.Save(@"C:\test\output.pdf");

Thank you!

HTML to PDF Inline approach : Issues while refering external CSS file

$
0
0

Hi Aspose team,

 

We are using Aspose.pdf for converting html to pdf. In our html we are referring multiple CSS files. We are using pdf.HtmlInfo.ExternalResourcesBasePath = http://abc:123 to provide base path url for external CSS file and we are referring below mentioned CSS files through <link> tag in html page.

href='/_layouts/15/1033/styles/Themable/corev15.css?rev=ox%2BqLd6WTqhn6d%2FMqf2BMw%3D%3D'

href='/sites/DPATL/Style%20Library/en-US/Themable/Core%20Styles/controls15.css'

Now the problem here is we have added one class in above corev15.css file
  .caption img {
    height: auto;
    width: auto;
    -webkit-border-radius: 20px;
    border-radius: 20px; }

Baiscally this class provides rounded edges for images, but we are unable to find rounded edges in PDF file that is getting generated.(Rest all classes in that CSS file are getting applied) :(
And it is also observed that controls.css file is not getting applied at all in pdf.


Can you team guide us with solution on this issue..? In our code we are also passing network credentials to access images.

 

Thanks in advance.


 

 

 

 

 

 

 

Linux Mint

$
0
0
Is Aspose Total for Java support on Linux Mint 17? I am having issues with a couple of your sample apps. For the following one I am getting an index out of bounds exception on http://www.aspose.com/docs/display/pdfjava/how%20to%20convert%20an%20image%20to%20pdf pdf1.save("d:/pdftest/TextAlignmentTest.pdf"); For the following one readers.next() is always null http://www.aspose.com/docs/display/pdfjava/Convert+TIFF+frames+to+JPEG+compression+and+transform+to+PDF

Issue with FontAbsorber

$
0
0
I am trying to get the font list from PDF. With every run, the objFontAbsorber.Visit(objPdfDocument) is returning same count of fonts (50 in my case). When I try to get distinct fonts from the FontCollection object, I am getting different counts for same PDF. Sometimes it is 9, sometimes 10 and sometimes 11. It's weird. Can you please suggest something into this?

The code for the same is given below.

try
            {
                List<string> fontList = new List<string>();
                Document objDocument = new Document(this.PdfPath);
                FontAbsorber objFontAbsorber = new FontAbsorber();
                objFontAbsorber.Visit(objDocument);
                foreach (Aspose.Pdf.Text.Font font in objFontAbsorber.Fonts)
                {
                    fontList.Add(font.FontName);
                }

                return fontList;
            }
            catch
            {
                throw;
            }

The PDF document is attached.

I need an urgent response, please help me out.

PDF to DOCX - preserve hyperlinks

$
0
0
Hello,
I'm converting the attached PDF file to DOCX with Aspose PDF.

It converts pretty well, but there are no hyperlinks in the DOCX file.  The text is blue and underlined, but is not hyperlinked.  The DOCX file is also attached

The code is as follows:

<cfset docSaveOptions=createObject("java","com.aspose.pdf.DocSaveOptions").init()>
<cfset docSaveOptions.setFormat(1)>
<cfset docSaveOptions.setMode(1)>
<cfset docSaveOptions.setRecognizeBullets(true)>
<cfset pdf=createObject("java","com.aspose.pdf.Document").init(tempFile)>
<cfset pdf.save(tempDocXFile,docSaveOptions)>
<cfset pdf.close()>




Thank you.

HTML conversion to PDF

$
0
0

We have to convert HTML to PDF.  Attached is the HTML and the PDF we are generating with aspose.pdf.  We are using the latest version.

The text within tables is not flowing correctly.  What needs to be done to convert the HTML as close as possible to a PDF?

J

using aspose pdf to pre-fill data to 2014 W4 form

$
0
0
Hi, I'm having an issue to update data to the field c1_01[0], c1_01[1], c1_01[3] which stands for "single", "married" & "married, but..." checkbox on the 2015 W4 form. For some reason, I'm getting an error "c1_01 can't be defined as global field & non-global field" when open up the pdf. do you have any advise? Question 2, for the employee's signature & date fields. how do you pre-fill values to it since they don't have field names? As a reference, assign "signature" & "date" on 2013 W4 works well but not the 2015 form. thanks

Display of Attachments in a Table

$
0
0

Hello Aspose,

I would like to join an attachment and a image so that it looks like one image (the pin appears in top/left corner of the image). Please see the upload PDF.

To reach this I did this:

private static void Main(string[] args)
{  Pdf pdf1 = new Pdf();  Section sec1 = pdf1.Sections.Add();  Table table1 = new Table();  sec1.Paragraphs.Addtable1 );  table1.DefaultCellBorder = new BorderInfo( (intBorderSide.Allnew Aspose.Pdf.Generator.Color"LightSkyBlue" ) );  table1.ColumnAdjustment = ColumnAdjustmentType.AutoFitToContent;  Row row1 = table1.Rows.Add();  Cell cell1Row1 = row1.Cells.Add();    Attachment fileAttachment = new Attachment();    cell1Row1.Paragraphs.AddfileAttachment );    fileAttachment.AttachmentType = AttachmentType.File;    fileAttachment.AttachedFileName = @"F:\tfs\Entwicklung\bin\x86\Debug\DemoImage";    fileAttachment.AttachedFileType = "jpg";    fileAttachment.FileIconType = FileIconType.PushPin;    fileAttachment.IconColor = new Color"Brown" );    fileAttachment.NoteContent = "Attachment 1";  Cell cell2Row1 = row1.Cells.Add();    Image fileAttachment2 = new Image();    cell2Row1.Paragraphs.AddfileAttachment2 );    fileAttachment2.ImageInfo.ImageFileType = ImageFileType.Jpeg;    fileAttachment2.ImageInfo.File = @"F:\tfs\Entwicklung\bin\x86\Debug\DemoImage";  pdf1.Saveargs[1] );
}
The result is exaclty what I want, but it seems to me that this is not your expected result. So I'm afraid of a future bug-fix.
Could you please tell me or how to reach that correctly.
Regards
Gerd

aspose question

$
0
0
I need to convert .DOC and .DOCX files to PDF in a VB.NET program. Which of your products would I need to purchase to accomplish this? Just ASPOSE.word OR would I also need ASPOSE.PDF?
This message was posted using Banckle Live Chat 2 Forum

Problem With Get Values from All Fields in a PDF Document Example

$
0
0
I am trying to extract data from an existing PDF Form and I am trying to use the posted example to understand how to extract all user supplied values from a PDF document/form.  When I try to use the posted example code:  (see "Get Values from All Fields in a PDF Document")

// Java
//
// Open document
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("input.pdf");
com.aspose.pdf.Form form = pdfDocument.getForm();
IEnumerator fi = form.iterator();
while(fi.hasNext()) {
  // Get the name of form field
  System.out.println(((com.aspose.pdf.Field)fi.next()).getPartialName());
  // Get the value associated with form field
  System.out.println(((com.aspose.pdf.Field)fi.next()).getValue());
}// end while loop

I cannot determine the proper import for the IEnumerator object used to iterate through the "input.pdf".  It appears this is an outdated example because the only referrences to an IEnumerator object are found in the Aspose.Slides or Aspose.email.Collections libraries.  Can someone either clarify which import should be used, or provide an updated sample?

Thanks.
Ed

extract dc metadata from pdf

$
0
0
Hello,

I would like to extract the dc metadata from a pdf file. Using the getByDefaultMetadataProperties, I am able to extract the creatorTool, creatorDate, ModDate, ModCreator, and Identifier, but I would like to extract all the dc metadata my document contains and this is not all of it.
So I tried using xmpMetadata.getXmpMetadata()  but it returns an Object and I don't know what to cast it into to get the right string. I also tried using xmpMetadata.getValues which seems to hold all the information I need when looking at it with the debugger but it is all obfuscated and I can't access the data in there.

Here is my code:
PdfXmpMetadata xmpMetadata = new PdfXmpMetadata(uploadContext.document.getPdfDocument());
System.out.println("creatorTool: " + xmpMetadata.getByDefaultMetadataProperties(DefaultMetadataProperties.CreatorTool)); // OK
System.out.println("identifier: " + xmpMetadata.getByDefaultMetadataProperties(DefaultMetadataProperties.Identifier)); // OK
System.out.println("dc:format: " + xmpMetadata.getXmpMetadata("dc:format"));// NOPE
System.out.println("dc:title: " + xmpMetadata.getXmpMetadata("dc:title"));
System.out.println("dc:creator: " + xmpMetadata.getXmpMetadata("dc:creator"));// NOPE
System.out.println("dc:description: " + xmpMetadata.getXmpMetadata("dc:description"));// NOPE
System.out.println("dc:description: " + xmpMetadata.getXmpMetadata("dc:rights"));// NOPE
System.out.println("xmp:CreatorTool: " + xmpMetadata.getXmpMetadata("xmp:CreatorTool")); // this does not work either

Thanks,

Camille.
Attached is an example document

Creating Document object is very slow

$
0
0
I am converting a PCL file to PDF, and it is taking me an average of 8 seconds.
I did some debugging and noticed that the following line of code takes an average of 6 to 7 seconds.

Document doc = new Document(pclFilePath, new PclLoadOptions());

Then I tried to create another Document object, in the same scope as the previous one

Document doc2 = new Document(pclFilePath, new PclLoadOptions());

and it took an average of 1 second.

Why does it take so much time to create a Document object the first time? And how can I make it faster?

Mail Merge

$
0
0
Hi, I am creating a word doc with merging two templates and I want to print that one in PDF with print pop up without displaying it on the browser.

Any answers will be appreciated???

Replave an embeded attachment with another document

$
0
0
Hi
I have a PDF document with embedded attached Excel documents.
I want to replace the attachments with other Excel document and still keep the shapes with the links in the PDF document.
What is the way to do this? Can you give an example for that?

Thanks
Tali.

Inline css in string variable filled with html text does not get displayed correctly in PDF.

$
0
0

We have a custom action in SharePoint 2013 on a custom list that leads to a page that generates a pdf via the Aspose.PDF .NET dll (downloaded latest version of Aspose.Total DLL's last week).

In the code behind of the page we gather the info of the item we need and convert it to a pdf.

In SharePoint a rich text multi line field can contain a lot of inline styling. A title can be displayed as<span style="Color:#F000000;font-family:Comic Sans MS;">Title<span>. But when we convert it to the pdf the inline styling of the span is not displayed. It does not have the correct color or font. We need some help on this one.

Below are the most import pieces of the code we use to generate the pdf.

 

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

Aspose.Pdf.Generator.Section section = new Aspose.Pdf.Generator.Section();

string text = SPHttpUtility.HtmlDecode(item[fldText.InternalName].ToString().Replace("&#160;", "<br>"));

string cssBeginText = @"<!DOCTYPE HTML"">

                                       <HTML>

                                       <HEAD>

                                       <LINK REL=StyleSheet HREF=""" + url + @"/_layouts/15/Hubo_CustomAction_Print/MinimalStyling.css"">

                                       </HEAD>

                                       <BODY>";

string cssEndText = @"</BODY></HTML>";

text = cssBeginText + text + cssEndText;

Aspose.Pdf.Generator.Text body = new Aspose.Pdf.Generator.Text(text);

body.TextInfo.FontName = fontBody;

body.IsHtmlTagSupported = true;

body.TextInfo.IsFontEmbedded = true;

body.TextInfo.FontSize = fontziseBody;

section.Paragraphs.Add(body);

               pdf.Sections.Add(section);

               pdf.Save(@"overzicht.pdf", SaveType.OpenInAcrobat, Response);


 

Dispose TextAbsorber Object

$
0
0
Hi,

I've an issue similar to http://www.aspose.com/community/forums/thread/468794/how-to-limit-memory-usage-when-extracting-text-from-large-pdfs.aspx.

We are extracting text from many pdf files. TextAbsorber does not leave the memory it used. Is there any way to dispose TextAbsorber, except calling Garbage Collector?

Thanks,
Viewing all 3131 articles
Browse latest View live