Convert .jpg/.jpeg to .pdf Without Margins (Image Shrinking)

Hi,


I have what may be a simple question. I am using this article to convert jpg images of pages to pdfs:

Convert PDF documents using C# API|Aspose.PDF for .NET

The conversion works fine, EXCEPT, it shrinks the .jpg that is being inserted into the pdf. This is a bummer, because it makes our pages and barcodes less readable. The jpgs are the exact proportions of a 8.5 x 11 page, and they already contain a margin.

I believe my ultimate objective is to convert the .jpgs to .pdf without the generator adding any padding, margins, borders, etc. A raw insert for a lack of better words. I’ve tried manipulating the sections without any success (but I may not have done that in the right “place” or manner.).

I’ve attached my raw .jpg, as well as what is produced by the generator.

TIA, for any help at all.

Jim

Hi Jim,


Thanks for your inquiry. After initial investigation, I’ve found that image gets blur while setting the margin. We’ve logged the issue as PDFNEWNET-35646 in our issue tracking system for further investigation and resolution. We will keep you updated about the issue progress via this forum thread.

Sorry for the inconvenience faced.

Best Regards,

Hi,


The blur might come just from the margins proportions being off a bit. Can you show how you set the margins, so I can experiment a little bit? Thank you so much.

Jim

Hi there,

Thanks for your feedback, I’m setting section margins as following. We will update you via this forum thread as soon as its resolved.

//Instantiate a Pdf object by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
//Create a section in the Pdf object
Aspose.Pdf.Generator.Section sec1 = pdf1.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 page margin
sec1.PageInfo.Margin.Left = 0;
sec1.PageInfo.Margin.Right = 0;
//sec1.PageInfo.Margin.Top = 0;
//sec1.PageInfo.Margin.Bottom = 0;
//Set the path of image file
image1.ImageInfo.File = myDir + “start.jpg”;
//Set the type of image using ImageFileType enumeration
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;
//scale image according to page width/height
image1.ImageInfo.FixWidth = sec1.PageInfo.PageWidth;
image1.ImageInfo.FixHeight= sec1.PageInfo.PageHeight;
//Save the Pdf
pdf1.Save(myDir + “outpdfimg.pdf”);

Please feel free to contact us for any further assistance.

Best Regards,

Any news on this defect? This is really putting a cramp on our next release. I’d love any work-around ideas as well.

Hi James,


Thanks for your feedback. I’m afraid your reported issue is still not resolved, its pending for analysis in queue with other priority tasks. However, we’ve recorded your concerns and requested development team for ETA at their earliest. We will keep you update about the issue progress via this forum thread.

We are sorry for the the inconvenience caused.

Best Regards,

Hi,

I hope this message finds you well. We are in a bit of a spot with this issue. Here is where we are at:

Our core problem is that this is the last issue that we need to resolve before a major release. We have spent nearly 80 hours trying to determine an aspose-based work-around for the blurry image conversions, with no luck. We also noticed that images into pdfs are blurry in your demos as well:

http://www.aspose.com/demos/.net-components/aspose.pdf/vb.net/FO/Images.aspx

On a side note, it seems bizarre that Aspose products do some many things so well, but that this basic functionality is so defective. Perplexing and expensive on our end.

With that said, we are getting pretty desperate for a solution. Some further questions:

  1. Did this work with a previous version of Aspose? If so, which version. We will happily roll back if we have to.

  2. Can we pay you to fix this issue? At a bare minimum, if we renew our licensing package can expedite a solution for us?

  3. Can you recommend a competing product that you respect that you think may do a good job? We really hate to switch, because we’ve used Aspose for years now, but we feel we are running out of options. For example, one of my coders recommended exploring this option: vb.net - Converting multiple Images to pdf using pdfsharp - Stack Overflow

Please let me know if there is anything else we can do to help this problem along.

Sincerely,

Jim Ray

CTO/Co-Founder

FASTPORT

Hi Jim,

Thanks for your feedback.

JimFASTPorter:

Our core problem is that this is the last issue that we need to resolve before a major release. We have spent nearly 80 hours trying to determine an aspose-based work-around for the blurry image conversions, with no luck. We also noticed that images into pdfs are blurry in your demos as well:

[http://www.aspose.com/demos/.net-components/aspose.pdf/vb.net/FO/Images.aspx ](http://www.aspose.com/demos/.net-components/aspose.pdf/vb.net/FO/Images.aspx)

On a side note, it seems bizarre that Aspose products do some many things so well, but that this basic functionality is so defective. Perplexing and expensive on our end.

Our development team has investigated the issue and found that original JPEG-image document is of low enough quality. Sure, quality of image also can degrade a bit during scaling, it’s a natural thing. But original quality is bad enough, and if that low-quality image is magnified, that bad quality becomes more perceptive. And it seems that it’s main source of problems. Can you please scan and (or) convert to JPEG with better quality(more DPI) or take source image-file in original format of scanning and send us that better version? So we investigate it further and provide you information accordingly.

JimFASTPorter:

  1. Did this work with a previous version of Aspose? If so, which version. We will happily roll back if we have to.

We recommend to use latest version of Aspose.Pdf API, as we maintain a single code base and all fixes and features are included in latest version. So using some older version you can get into some other issues.

JimFASTPorter:

  1. Can we pay you to fix this issue? At a bare minimum, if we renew our licensing package can expedite a solution for us?

Yes purchase of enhanced support definitely raise your issue priority but resolution is subject to the complexity and priority of issue. Aspose offers three different types of enhanced support, please check following links for the details/prices and enhanced support FAQs.

We are sorry for the inconvenience caused.

Best Regards,

hey yea it wont work for me either… im having real trouble finding something that will convert my jpg to pdf at all…

can some please help me, currently im using http://jpgtopdf.de/ but it wont save the pdfs on my laptop properly…
does someone know how to do it with aspose?

Hi Geoffrey,


Thanks for your interest in our products.

Conversion of Image files to PDF format is very handy using Aspose.Pdf for .NET. Please download the latest release of Aspose.Pdf for .NET and following the instructions specified over following link for information on How to Convert an Image to PDF.

PS, Aspose.Pdf for .NET is programming API so you need to reference this component in your application.