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

IsLandscape destroys the image quality

$
0
0
Hello,

I create PDF from image in various resolutions, the problem is that when I set the PDF into landscape mode the quality of the image is destroyed.
I tried it withthe latest version (9.9.0) with the same result.

For example, an image with resolution 1176 (width) and 1058 (height).


The code :

var pdf = new Pdf();
pdf.CompressionLevel = 0;
pdf.IsLandscape = true;

pdf.PageSetup.Margin.Top = 0;
pdf.PageSetup.Margin.Right = 0;
pdf.PageSetup.Margin.Bottom = 0;
pdf.PageSetup.Margin.Left = 0;

foreach (var img in images)
{
      if (!ImpressionControlHelper.AllOneColor((Bitmap)img))
      {
            var sec = pdf.Sections.Add();
            //sec.IsLandscape = true;

            var image = new Aspose.Pdf.Generator.Image(sec);

            sec.Paragraphs.Add(image);

            image.ImageInfo.ImageStream = new MemoryStream(ImpressionControlHelper.ImageToByteArray(img));
            image.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Bmp;
      }
}

return pdf.GetBuffer();



Thank you for your help !

Text field in PDF form is not positioned the same for different pages

$
0
0
Hi Aspose.PDF Team,
- I have a PDF which 2 pages, 1st page has portrait orientation, 2nd page came from a PDF with landscape orientation but I already used Aspose.PDF to change to portrait A4.
- I then insert 2 text fields into 2 pages at the same position but they end up in 2 different places and text field on page 1 is placed horizontally when text field on page 2 is placed vertically.
- Here is the code I used to add text field:
Aspose.Pdf.Facades.FormEditor formEditor = new Aspose.Pdf.Facades.FormEditor();
formEditor.BindPdf(helloWorldFilePath);
formEditor.AddField(Aspose.Pdf.Facades.FieldType.Text, "textfield", 1, 100, 100, 200, 150);
formEditor.AddField(Aspose.Pdf.Facades.FieldType.Text, "textfield", 2, 100, 100, 200, 150);
formEditor.Save(helloWorldFilePath);
- Here is the code I used to convert 2nd page from portrait to landscape A4:
//resize landscape to portrait
PdfPageEditor pageEditor = new PdfPageEditor();
using (Aspose.Pdf.Document document = new Aspose.Pdf.Document(inputPath))
{
       pageEditor.BindPdf(document);
       Aspose.Pdf.Rectangle r = document.Pages[1].Rect;
       pageEditor.Zoom = (float)(r.Width / r.Height);
       pageEditor.Save(outputPath);
}
//change to portrait A4
PdfPageEditor pEdit = new PdfPageEditor();
PdfFileEditor fileEditor = new PdfFileEditor();
using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document(originalFilePath))
{
        pEdit.BindPdf(doc);
        pEdit.PageSize = Aspose.Pdf.PageSize.A4;

        for (int i = 1; i <= numOfPages; i++)
        {
                var pageSize = pEdit.GetPageSize(i);
                PdfFileEditor.ContentsResizeParameters par = new
                     PdfFileEditor.ContentsResizeParameters(
                            PdfFileEditor.ContentsResizeValue.Percents(0)
                            PdfFileEditor.ContentsResizeValue.Percents(Aspose.Pdf.PageSize.A4.Width * 100 / pageSize.Width),
                            PdfFileEditor.ContentsResizeValue.Percents(0),
                            PdfFileEditor.ContentsResizeValue.Percents(0),
                            PdfFileEditor.ContentsResizeValue.Percents(Aspose.Pdf.PageSize.A4.Height * 100 / pageSize.Height),
                            PdfFileEditor.ContentsResizeValue.Percents(0));

                fileEditor.ResizeContents(doc, new int[] { i }, par);
        }

        pEdit.Save(outputDocumentPath);
}

- How can I make text field on page 2 displayed the same position and horizontally as text field in page 1? Thanks.

error on pdf highlighted

$
0
0
hi we try your library for highlight some words in pdf everythings works well but on some pdf we have an error message on pdf open i attach the two pdf one is before "test.pdf" and one is after "output.pdf" also i attach the error message when i open "output.pdf" the words highlighted is "adidas"

best regards

how to update hyperlink text in pdf using itextsharp in c#

$
0
0
0 down vote favorite my requirement is need to update hyperlink and hyperlink text in pdf using Itextsharp in c#.net application.I can able to update hyperlink address but how to change hyperlink text for example : hyperlink is : http://www.google.com hyperlink text is : ClickHere I want change "ClickHere" to "SearchHere" Any help,Appreciated

Large MultiPage PDF generated using Aspose PDF 7.2

$
0
0
Hi,

I have been using Aspose 7.2 PDF for .Net 4 framework. I have a bunch of images (approx 55 pages) which i will be converting to PDF format. When it gets converted to MultiPage PDF, its file size becomes significantly Large. 

For example : For sample attached image, when the same image used to create 55 MultiPage PDF, it would create larger Multipage PDF.

Please let us know how can we achieve optimum quality along with Minimum size.

TIFF to PDF convert - PDF filesize getting over 3 times as big

$
0
0
Hi, im trying to convert the attached TIFF to PDF using the following code:

        Dim pdf1 As Pdf = New Pdf()
        Dim sec As Section = pdf1.Sections.Add()

        Dim ms As MemoryStream = New MemoryStream(<File>)
        Dim myimage As New Bitmap(ms)

        Dim imageht As Aspose.Pdf.Generator.Image = New Aspose.Pdf.Generator.Image(sec)
        imageht.ImageInfo.ImageFileType = ImageFileType.Tiff
        imageht.ImageInfo.ImageStream = ms
        imageht.ImageInfo.IsBlackWhite = false
        sec.Paragraphs.Add(imageht)

        Dim tifstream = New MemoryStream()
        pdf1.Save(tifstream)

---

The tif size is 285 kb
The converted PDF file is 954kb

When I set the "IsBlackWhite" to "true", the PDF filesize drops to 300kb.
But im not intererested in converting the tiff to BlackWhite.

How can I convert the TIFF to PDF without the filesize getting much bigger?

Very Urgent - TextFragmentAbsorber not absorbing multiple text

$
0
0
Creating a object like this,

 var textFragmentAbsorber = new Aspose.Pdf.Text.TextFragmentAbsorber("ExampleText");

it works good but only when text is on single line but it ignores the text if it's on multi-line.

Very urgent.

Cheers

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.


 

 

 

 

 

 

 


Having trouble getting the workflow actions to show up in SPDesigner

$
0
0
Having trouble getting the workflow actions to show up in SPDesigner. The error is referencing a dll version that is lower than the dll in the assembly and in the web.config.

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!

converting PDF to PDF/A increases file size

$
0
0
I had asked about this in an earlier thread:
http://www.aspose.com/community/forums/thread/562315.aspx

And was instructed:
You may used Aspose.Pdf for .Net for optimizing the PDF file. Please check Optimize PDF file size documentation for the purpose. Hopefully it will help you to reduce the file size.

We are now working with Aspose 9.9.0 and I've found something interesting in my testing to pinpoint this issue. 

Using a Word document I created a PDF 3 ways:  Using Word’s built-in feature, Amyuni and Aspose.  It appears that Word creates a PDF that when Aspose converts to a PDF/A it increases in size.

Please see my attachment graphic showing changes in file sizes, and my samples.

Can you shed any light on this?

Thanks,

Kristen Theologus



HTML form to PDF - make all fields read only

$
0
0
I am using Aspose.PDF to convert HTML to PDF. The HTML has form input elements with values populated. Is there a way to specify that all fields in the output PDF be made read-only?

PDF To tiff is not working well

$
0
0
Hello,

Please find attached pdf. When i tried to convert this pdf to tiff, it cant convert.

var tiffSettings = new TiffSettings
                                                                          {

                                                                              Compression = CompressionType.CCITT3,

                                                                              Depth = Aspose.Pdf.Devices.ColorDepth.Format1bpp,

                                                                              Shape = ShapeType.None,
                                                                              SkipBlankPages = true

                                                                          };

extract pdf fields including checkboxes

$
0
0
Hi There,

I am trying to get all Pdf fields (textbox, checkbox, date etc). When I tried following code I am  getting 4 fields only. Am I missing something?

Aspose.Pdf.dll
Version: 9.9.0.0

Code:
 public static void Main(string[] args)
        {
            Document pdfDocument = new Aspose.Pdf.Document("..//template.pdf");
            //get values from all fields
            foreach (Field formField in pdfDocument.Form)
            {
                Console.WriteLine("Field name : {0} ", formField.PartialName);
            }

            Console.ReadLine();
        }
Result:
Filed name: Petitioner
Filed name: Respondent
Filed name: No
Filed name: Calendar

I have attached template.pdf file.

Thanks
John

Can i add Aspose.Pdf.Heading just for adding hyperlink to page ?

$
0
0
While I am adding some information to Pdf I am creating, can I add Aspose.Pdf.Heading object to cell, so that i can navigate user to some page in the document ?

Textbox with Justify not working when text contains a parameter

$
0
0
Hi

Is it by design or a bug that text justify works fine unless I put a parameter or other expression into the text?

Thanks,
Greg

Feature Request

$
0
0
Older API,

http://www.aspose.com/docs/display/pdfnet/Aspose.Pdf.Generator.Segment.Segment+Hyperlink+Property

Newer API,

http://www.aspose.com/docs/display/pdfnet/Aspose.Pdf.Text.TextSegment+Class


I used to use ActivePDF but on my recommendation I made my manager agree on using ASPOSE API, we already bought few licenses. Now I am stuck at this point, i must need to add hyper links to segments without providing dimensions of text segments.

It would be nice if we can add hyperlink to page number that don't exist yet.

Now my manager is after me for a release date of product, if you can't provide me with a date for this request then I unfortunately - need to roll back and use newer ActivePDF API.


Another thing holding our project is using document.Save() method and keeping reference to objects + getting right number of pages.

Doesn't matter how long you say, just reply back with a date for above features please/

If no date will be provided till Tuesday 29th then unfortunately I will have to drop this project and stick to ActivePDF for future developments.

Much Appreciated

aspose.pdf for arabic support

$
0
0
Does ASPOSE.pdf supports arabic.. how can I Check
I need it for extraction, find/replace , highlight, display the new highlighted pdf in asp.net
best regards

Default header and footer for pages in com.aspose.pdf

$
0
0
Hi

Can you please let us know how to set default header and footer for all the pages of the document using com.aspose.pdf api

Regards
Praveen

TIF conversion is not happening

$
0
0
Hi Team,

We are trying to convert a pdf to tiff.

public static System.Drawing.Image[] ConvertPDFtoMultiPageTiff(string OutputFolder, string FullInputFileName)
        {
            System.Drawing.Image[] sourceImages = null;

            try
            {
               
                Document pdfDocument = new Document(FullInputFileName);
                //create Resolution object
                Resolution resolution = new Resolution(300);
                //create TiffSettings object
                TiffSettings tiffSettings = new TiffSettings();

                tiffSettings.Compression = CompressionType.CCITT4;
                tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format8bpp;

              
                if (tiffSettings.Shape == ShapeType.Landscape)
                    tiffSettings.Shape = ShapeType.Portait;
                tiffSettings.SkipBlankPages = false;
                //tiffSettings.Brightness = .40f;

                Stream output = null;
                sourceImages = new System.Drawing.Image[pdfDocument.Pages.Count];
                //create TIFF device
                TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);


                for (int page = 1; page <= pdfDocument.Pages.Count; page++)
                {
                    Aspose.Pdf.ColorType pageColorType = pdfDocument.Pages[page].ColorType;
                    if (pageColorType == ColorType.Rgb)
                    {
                        tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Default;
                    }

                    else
                    {
                        tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Format1bpp;
                    }

                    output = new MemoryStream();
                    //tiffDevice.Process(pdfDocument, page, page, Path.Combine(OutputFolder, String.Concat(Path.GetFileNameWithoutExtension(FullInputFileName), ".",page.ToString().PadLeft(3, '0'))));

                    tiffDevice.Process(pdfDocument,page,page, output);


                    sourceImages[page - 1] = System.Drawing.Image.FromStream(output);

                    sourceImages[page-1].Save(Path.Combine(OutputFolder, String.Concat(Path.GetFileNameWithoutExtension(FullInputFileName), ".", page.ToString().PadLeft(3, '0'))));

                    output = null;
                   
                }


              

            }
            catch (Exception ex)
            {
                sourceImages = null;
                throw new Exception(String.Format("Error in splitTiffPages: {0}", ex.Message));
            }


            return sourceImages;
       

This is the code we are using.
But when i debugg the code
   for (int page = 1; page <= pdfDocument.Pages.Count; page++)
                {
                    Aspose.Pdf.ColorType pageColorType = pdfDocument.Pages[page].ColorType;

at this point the application is getting hanged while checking the color type.
Can you please check this?

Regards
Anish
Viewing all 3131 articles
Browse latest View live