Quantcast
Viewing all 3131 articles
Browse latest View live

Hide PDF Content

Hi,

I have an pdf file that same file will be displayed to all users. But what i want is depending on the user logged in

i have to hide content in the same pdf. is it posssible?

I have to hide paragraph 1 for user 1

for user 2 want to display all the pdf

convert pdf bookmarks to table of contents using aspose.pdf

Hi,
I need to Convert PDF Bookmark to TOC (table of content)

New destination of changed bookmark destination will not get saved!

I tried to update the bookmarks so of an existing pdf so that it`s destinations all will keep the zoom factor the user has selected when following the bookmark (as know as inherit zoom)

My code passes throuh the Outlines Collections, checks wether the Destination is an Aspose.Pdf.InteractiveFeatures.XYZExplicitDestination and if not, creates a new XYZExplicitDestination and assigns it to the destination member of the Outline (alternatively, I tried to assign a new GoToAction to the action member).  To figure out the changed bookmark, I also change the bockmark text.

When the PDF is saved, the text of the respective bookmarks is changed but the destinations remain unchanged!

I added my code as attachment (as it is a bit lengthy, the important part is method setInheritZoom)!

Can anyone figure out what is wrong with my code?

Thanks

FieldNames Can't be Found!

I created a PDF using the Aspose.Pdf.Generator.Pdf and saved it to a MemoryStream.
I created a Aspose.Pdf.Facades.Form using that MemoryStream.
When I tried to get the names of the fields using FieldNames property of the Form, it returned an empty list.
GetField method also fails when I look for the names of the fields.

I do not have this problem when I use the FormEditor to create the fields. However, I am using the generator to generate my PDF.

I would like some help getting this to work.

I have also included a sample C# file I wrote using Window Forms Application.
I am using .net 3.5 and Aspose.Pdf 9.2.0.0

PDF-Form field names with leading underscore

Hello experts,

I'm using the fillable pdf formular in the attachment. This worked fine with previous versions of Aspose.PDF, but as soon as I update to the newest Library (9.3) I get a NullReferenceExpetion in the library with no change my code.

I try to fill the field with name "44.name_vorname". I can see the field in the list of the form.FieldNames list but then when the FillField mehtod is called a null reference exception is thrown. As I can see in Adobe Acrobat all the fields are defined with a leading underscore (so the "real" name is "_44.name_vorname"), maybe the leading underscore leads to the problem?

Thanks for any help,
regards
Ivan 

How to read multiple columns

Hello, 
I'm struggling to be able to read a PDF with 2 columns per page. 

As you can read a PDF (version 9.3.0.0) file that has two columns with the exception of the header and footer? I can not find a code sample!

I have a question about aspose.pdf

Inserting image into PDF question

Hi,

how can I insert/convert an image into PDF with some size adjustment?
I mean I want to resize the image if the size is bigger than the A4 page size to fit it into the page.
If the image size is smaller than A4, the image should be centered.

Is there any way to do that?

Thank you,
Mariusz

Facing problem when i convert text file to pdf file in java

my code is :com.aspose.pdf.Document doc = new com.aspose.pdf.Document("C:\\Users\\mbehera\\Desktop\\MigrationTest\\today.txt");
doc.save("C:\\Users\\mbehera\\Desktop\\MigrationTest\\out.pdf");

and i facing the below Exception : 
com.aspose.pdf.exceptions.InvalidPdfFileFormatException: Incorect file format
at com.aspose.pdf.internal.pt.f.a(Unknown Source)
at com.aspose.pdf.internal.ok.y$a.a(Unknown Source)
at com.aspose.pdf.internal.ps.h.a(Unknown Source)
at com.aspose.pdf.internal.po.q.<init>(Unknown Source)
at com.aspose.pdf.internal.po.q.<init>(Unknown Source)
at com.aspose.pdf.internal.oo.b.Hm(Unknown Source)
at com.aspose.pdf.internal.po.p.<init>(Unknown Source)
at com.aspose.pdf.internal.oo.b.Hp(Unknown Source)
at com.aspose.pdf.internal.ml.f.FB(Unknown Source)
at com.aspose.pdf.internal.ml.f.<init>(Unknown Source)
at com.aspose.pdf.ADocument.dg(Unknown Source)
at com.aspose.pdf.ADocument.<init>(Unknown Source)
at com.aspose.pdf.Document.<init>(Unknown Source)

Issue in rendering \n using TextFragment

Hi,

I am adding the below text fragment to a table cell but it is not rendering the new line character. I want to dispaly like
                                              Heading 1
                                           Table of Contents

but is displaying like Image may be NSFW.
Clik here to view.


TextFragment textFragment = new TextFragment("Heading 1 \n Table of Contents");

Best Regards

Watermark text stamp affecting the main body of a pdf page

I am using text stamps to add annotations to an existing PDF file.  One of the stamps is creating a watermark across the page.  This is added with :
oTextStamp = New TextStamp("RESTRICTED")
oTextStamp.Background = False
oTextStamp.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Helvetica")
oTextStamp.TextState.FontSize = 108
oTextStamp.XIndent = 7
oTextStamp.YIndent = 36
oTextStamp.RotateAngle = 55     
oTextStamp.Opacity = 0.1
oTextStamp.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Black)
oCurrPage.AddStamp(oTextStamp)

On some scanned in PDF files, although the result looks fine, when the resulting page is printed, the text that is underneath the 'RESTRICTED' word is no longer readable.

This seems to print out wrongly using versions of Acrobat Reader except for the latest Version XI.

Most pdf files that are stamped are also fine, it seems to be something to do with how they are scanned.

I attach a copy of an original file, stamped file and a picture of the printed page.

Can you suggest any different way that I can stamp a word across the pages that would get around this problem ?

Thanks
Fiona Treveil

Upgraded .lic file throws "the license is not valid for this product" error

Hi,

      We had recently upgraded the Aspose.Total.Lic file since our subscription expiry date has ended. However, once we had updated from LicenseVersion "2.2" to "3.0", we started receiving the error - "the license is not valid for this product"

 

Other Details:

Product: Aspose.Total for .NETAspose.Total for .NET

Edition Type: Enterprise

Aspose.Pdf.Kit.dll - File version - 4.9.0.0

Aspose.Pdf.dll - File version - 3.4.0.0

.Net Framework Version - 4.0

We just dropped the new .lic file instead of the old one and started receiving the error. Appreciate your prompt response.

 

Thanks,

Kalyan B

Font 'Times New Roman' not found. Please make sure the customer font file is correctly set.

I getting the following exception when calling pdf.save() on a "aspose.pdf.Pdf" object:
Caused by: java.lang.IllegalStateException: Font 'Times New Roman' not found. Please make sure the customer font file is correctly set.
	at aspose.pdf.internal.hv.a(Unknown Source)
	at aspose.pdf.internal.ht.c(Unknown Source)
	at aspose.pdf.internal.ht.a(Unknown Source)
	at aspose.pdf.internal.io.a(Unknown Source)
	at aspose.pdf.internal.io.a(Unknown Source)
	at aspose.pdf.internal.kp.a(Unknown Source)
	at aspose.pdf.internal.ll.a(Unknown Source)
	at aspose.pdf.internal.la.a(Unknown Source)
	at aspose.pdf.xml.DocumentBase.a(Unknown Source)
	at aspose.pdf.internal.ka.a(Unknown Source)
	at aspose.pdf.Pdf.save(Unknown Source)
I'm not using that font anywhere in my pdf and a Font object is returned if I call the following method:

  • com.aspose.pdf.FontRepository.findFont("Times New Roman");

Limitations for PDF documents created with Aspose.PDF

Hello,

are there any limitations regarding dimensions of a PDF document created with Aspose.Net.PDF?

I'm trying to convert a very large XPS Document into a PDF using the following code.

using (var pdf = new Document(source, new XpsLoadOptions()))
{
       pdf.Save(file);
}

The XPS document itself is about 130 MB file size (containing many images) and the dimensions are about 180.000 x 80.000 units. I did a test which takes very very long time with an average memory usage of about 1 GB ram and about 35% CPU consumption on an iCore 5. The result is a blank page.

If I know the limitations, maybe I can scale down the XPS to the maximum dimension.

Thanks

Sample JPEG produces blank PDF

We use Aspose.PDF for converting various image files to PDF. Most all images we convert have no problem. But we've recently encountered a couple of .jpg image files that will not convert.
The files do open successfully in MS Paint and Windows Photo Viewer.

I've attached one of those for your testing (wont_convert.jpg).
Oddly enough, I have taken that same attached file and (using MS Paint) converted it to:
- .tif
- .png
- .bmp
Those all successfully convert to PDF using Aspose.PDF.

Finally, if I re-convert the .png back to .jpg (again using MS Paint), the resulting .jpg file successfully converts to PDF with Aspose.PDF.

So it appears there is something in the initial format of these troublesome files that Aspose is not recognizing.

Here's a snippet of code showing how we use Aspose.PDF for image conversion:

//Instantiate a Pdf object by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdfGen = new Aspose.Pdf.Generator.Pdf();

//Create a section in the Pdf object
Aspose.Pdf.Generator.Section sec1 = pdfGen.Sections.Add();

//Create an image object in the section
Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);

//Add image object into the Paragraphs collection of the section
sec1.Paragraphs.Add(image1);

//Set the path of image file
image1.ImageInfo.File = file;

//Set the type of image using ImageFileType enumeration
string ext = Path.GetExtension(file).ToUpper();
switch (ext)
{
case "TIFF":
case "TIF":
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff; break;
case "BMP":
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Bmp; break;
case "GIF":
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Gif; break;
case "JPG":
case "JPEG":
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg; break;
case "PNG":
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Png; break;
}
pdfGen.Save(targetFile);

Thanks,
Jeff

PDF file increse file size after Optimization

Hi,

We have a lot of files scanned on KODAK scanners and when pass this code to optimize size we have a file 10 times bigger!

With some files, not scanned from KODAK, his code works good. Were is our fault?

We update our DLLs to version 9.3.0 and the problem persists.

Please, what is going wrong with this file?

Attached a file (my Test.pdf)  for you test.

CODE 1 - With OptimizeResources: (Original File attached = 2.302KB > Result 30.205KB)

var pdfDocument = new Document(caminho);
                foreach (Page page in pdfDocument.Pages)
                {
                    int idx = 1;
                    foreach (XImage image in page.Resources.Images)
                    {
                        using (var imageStream = new MemoryStream())
                        {
                            image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png, 72);
                            imageStream.Seek(0, SeekOrigin.Begin);
                            page.Resources.Images.Replace(idx, imageStream, 80);
                        }

                        idx = idx + 1;
                    }
                }

                pdfDocument.OptimizeResources(new Document.OptimizationOptions()
                {
                    LinkDuplcateStreams = true,
                    RemoveUnusedObjects = true,
                    RemoveUnusedStreams = true
                });               

                pdfDocument.Save(diretorioDeSaida + "\\" + "teste.pdf");

CODE 2 - without OptimizeResources:(Original File attached = 2.302KB > Result 21.384KB)

var pdfDocument = new Document(caminho);
                foreach (Page page in pdfDocument.Pages)
                {
                    int idx = 1;
                    foreach (XImage image in page.Resources.Images)
                    {
                        using (var imageStream = new MemoryStream())
                        {
                            image.Save(imageStream);
                            page.Resources.Images.Replace(idx, imageStream, 80);
                        }

                        idx = idx + 1;
                    }
                }

                pdfDocument.Save(diretorioDeSaida + "\\" + "teste.pdf");

Thanks,

Not able to specify a name to the pdf portfolio

Hi,

I want to customize the name column in the pdf portfolio top section which shows the list of individual files. By default, it shows the file name. For us the file name is meaningless and we generate the files based on an id. So instead of showing the file name, I want to specify a readable name. I do not see any API in the com.aspose.pdf.FileSpecification class.

Can you please help us to customize this?

Thank you.

Regards,
Siva

Not able to open Pdf portfolio in Chrome and Firefox

Hi,

We need the capability to show the generated pdf portfolio files in the browser. But all we see is a blank page. When we download the pdf portfolio file to the system and open it in the Adobe reader, we are able to see the file content.

Can you please help us to resolve this?

Thank you!

Regards,
Siva

Layout option in pdf portfolio

Hi,

I have raised this earlier. In Pdf portfolio files, we need to have the capability to split the window vertically by default. The default behavior is a horizontal split and it is very less usable and the scroll bars does not work either.

So we should have an option of opening the files with windows split vertically. Do you have an estimated time of when this will be available?

The default behavior makes the pdf portfolio almost unusable and this is a critical requirement for us.

Waiting for your response on this.

Thank you!

Regards,
Siva

Vertically align image?

Hi -

Is there a way to align an image vertically within a page beside me calculating the top margin?

Thanks!
Viewing all 3131 articles
Browse latest View live