Free Support Forum - aspose.com

Problems converting a psd


#41

Hello we tried with aspose.imaging 18.4 but it seems nothing is changed.

Again the resulting pdf/png created from psd are of very poor quality and wrong text layers
+
Conversion of psd to pdf and then from generated pdf to a png causes an extra white space issue.
+
the introduction of the option
_PngDeviceP.RenderingOptions = new Aspose.Pdf.RenderingOptions() { ScaleImagesToFitPageWidth = true };
causes a wrong resize in all PDF documents converted into images.

Archive.zip (265.2 KB)

3.9 libraries did not have these problems.
Please let us know as soon as you can.
Thanks


#42

@BooleServer,

Thank you for your feedback. We are looking in to it. We will update you soon.


#43

@BooleServer

Thanks for your inquiry.

We have tested PDF to PNG Conversion while using Aspose.PDF for .NET 18.5 with following code snippet and were unable to notice white space issue in the output PNG file.

Document pdfDocument = new Document(dataDir + "presentazione generale ritaglioLight.psd export.pdf");
for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
{
 string tmpImgToInsert = pageCount + "_" + DateTime.Now.Ticks + ".png";
 using (FileStream imageStream = new FileStream(dataDir + tmpImgToInsert, FileMode.Create))
 {
  // Create Resolution object
  Resolution resolution = new Resolution(120);
  // Create PNG device with specified attributes
  PngDevice pngDevice = new PngDevice(resolution);
  pngDevice.RenderingOptions = new RenderingOptions() { ScaleImagesToFitPageWidth = true };
  // Convert a particular page and save the image to stream
  pngDevice.Process(pdfDocument.Pages[pageCount], imageStream);
  imageStream.Close();
 }
}

1_636625154124415880.jpg (52.7 KB)

For your reference, an output image has also been attached. Could you please try Aspose.PDF for .NET 18.5 in your environment and share with us in case you face any other issue. We will further proceed to assist you accordingly.


#44

With 18.5 seems to be ok with the extra white space problem.
Remain the poor quality problem…original blu layers turned to grey, text layers and so on
We’ll do more test with 18.5 for the extra space in the next days.


#45

@BooleServer

As soon as earlier logged issue i.e. IMAGINGNET-2520 gets resolved, we will definitely update you within this forum thread. Please spare us little time.

Please take your time to further test the scenarios, and let us know in case you face any issue.


#46

Hello again, with aspose.pdf 18.6 our customers experience some problems converting pdf files into images, and we noticed also this bad conversion for example converting some documents (eg PPTX) into pdf and then from generated pdf to image (direct conversion from pptx to png works good) but in any case there is a problem in conversion from som pdf documents into png.
So it seems to be again this problem regarding PDFNET-40901 or something related.
We attach some sample files archive.zip (6.5 MB)
with this kind of problem.

the problem is the same: with this code:

            Aspose.Pdf.Devices.Resolution ResolutionP = new Aspose.Pdf.Devices.Resolution(m_iResolution);
            Aspose.Pdf.Devices.PngDevice PngDeviceP = new Aspose.Pdf.Devices.PngDevice(ResolutionP);
            PngDeviceP.RenderingOptions = new Aspose.Pdf.RenderingOptions() { ScaleImagesToFitPageWidth = true };
            PngDeviceP.Process(((Aspose.Pdf.Document)m_oDocument).Pages[++_iPageIndex], _oOutputStream);

commenting the ScaleImagesToFitPageWidth option it goes ok, but this option was inserted for solving the problems we are discussing in this thread…

Please solve it as soon as possible.


#47

@BooleServer

Thanks for getting back to us.

Would you kindly share the value of m_iResolution variable, so that we can test the scenario accordingly.


#48

Of course, is 120


#49

@BooleServer

Thanks for sharing requested details.

We have tested the scenario with your 3 files and observed that the API was not generating correct images when we used ScaleImagesToFitPageWidth option as true. However the output images were fine when we removed usage of this option.

Following issues have been logged in our issue tracking system, for your PDF documents. We will further investigate these issues and inform you in case of any progress towards their resolution. Please be patient and spare us little time.

PDFNET-44937 - (May 2018_StrategicPlanDashboard.pptx export.pdf export.pdf_)
PDFNET-44938 - (Income & Expenditure May 2018.pdf export_withoutoption.pdf)
PDFNET-44939 - (BrochureQuadr3ante_interno_RAST.pdf export.pdf)

We are sorry for the inconvenience.


#50

hello, no news from June 20…


#51

@BooleServer

Thanks for your inquiry.

I am afraid that earlier logged issue(s) are not yet resolved due to high number of pending issues in the queue. Since the issues have been reported under free/normal support model, they have low priority and will get resolved on fist come first serve basis unlike the paid/priority support model where issues are dealt with high precedence. As soon as we have some definite updates regarding resolution of your issues, we will let you know. Please spare us little time.

We are sorry for the inconvenience.


#52

I think 2 years and more (this thread exists from May 2016) is definetively too mutch time for (not) resolving some issues, even if reported as free support model (not premium support but still your customers paying for support and manteinance each year), isn’t it?


#53

@BooleServer

We surely value your concerns and realize the severity of the issues. However, please note that earlier logged issues which were reported in this thread were resolved already whereas, other three issues (i.e. PDFNET-44937;PDFNET-44938,PDFNET-44939) were logged on June 20, 2018. Due to large amount of previously logged issues, these issue could not get resolved.

Please note that we resolve every logged issue however, resolution time of the issues depend upon under which support model they were reported and how complex they are in nature. Nevertheless, we have recorded your concerns and will definitely consider them while resolving the issues. We will let you know as soon as we have some updates regarding resolution progress. Please spare us little time.

We are sorry for the inconvenience.


#54

@BooleServer,

I suggest you to please try using following alternate sample code on your end to serve the purpose for exporting PSD to PNG. Please share, if the issue is still incurring on your end. The change lies in following line of sample code.

 var m_oDocument = Aspose.Imaging.Image.Load(path + "presentazione generale ritaglioLight.psd", new PsdLoadOptions() { ReadOnlyMode = true });

The complete example code is: 
    var m_oDocument = Aspose.Imaging.Image.Load(path + "presentazione generale ritaglioLight.psd", new PsdLoadOptions() { ReadOnlyMode = true });
                    int m_iPageCount = 1;
                    Aspose.Imaging.ImageOptions.PngOptions OptionsI = new Aspose.Imaging.ImageOptions.PngOptions();
                    OptionsI.ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha;
                    //OptionsI.TransparentColor = new Aspose.Imaging.TransparentColorSetting(Aspose.Imaging.Color.Transparent);
                    Aspose.Imaging.ResolutionSetting oResI = new Aspose.Imaging.ResolutionSetting(
                        Convert.ToDouble(120),
                        Convert.ToDouble(120));
                    OptionsI.ResolutionSettings = oResI;

                    ((Aspose.Imaging.Image)m_oDocument).Save("saved2.png", OptionsI);
                    using (MemoryStream oMTempStream = new MemoryStream())
                    {
                        //  ((Aspose.Imaging.Image)m_oDocument).Save(oMTempStream, OptionsI);
                        ((Aspose.Imaging.Image)m_oDocument).Save(oMTempStream, OptionsI);
                        ((Aspose.Imaging.Image)m_oDocument).Save("saved.png", OptionsI);

                        Aspose.Pdf.Document oPdf = new Aspose.Pdf.Document();
                        Aspose.Pdf.Page oPage = oPdf.Pages.Add();

                        oPage.PageInfo.Width = 1000;
                        oPage.PageInfo.Height = 500;
                        oPage.PageInfo.Margin.Bottom = 0;
                        oPage.PageInfo.Margin.Top = 0;
                        oPage.PageInfo.Margin.Left = 0;
                        oPage.PageInfo.Margin.Right = 0;

                        double dResizeFactor = 0;
                        double dXsize = 0;
                        double dYsize = 0;
                        dResizeFactor = (((Aspose.Imaging.Image)m_oDocument).Width / oPage.PageInfo.Width
                                         > ((Aspose.Imaging.Image)m_oDocument).Height / oPage.PageInfo.Height)
                                            ? ((Aspose.Imaging.Image)m_oDocument).Width / oPage.PageInfo.Width
                                            : ((Aspose.Imaging.Image)m_oDocument).Height / oPage.PageInfo.Height;
                        dXsize = ((Aspose.Imaging.Image)m_oDocument).Width / dResizeFactor;
                        dYsize = ((Aspose.Imaging.Image)m_oDocument).Height / dResizeFactor;

                        if (((Aspose.Imaging.Image)m_oDocument).Width > ((Aspose.Imaging.Image)m_oDocument).Height)
                        {
                            //doc.PageInfo.IsLandscape = true;
                            double iW = oPage.PageInfo.Width;
                            double iH = oPage.PageInfo.Height;
                            oPage.PageInfo.Width = iH;
                            oPage.PageInfo.Height = iW;

                            if ((((Aspose.Imaging.Image)m_oDocument).Width > oPage.PageInfo.Width)
                                && (((Aspose.Imaging.Image)m_oDocument).Height > oPage.PageInfo.Height))
                            {
                                oPage.MediaBox = new Aspose.Pdf.Rectangle(0, 0, dXsize, dYsize);
                                oPage.CropBox = new Aspose.Pdf.Rectangle(0, 0, dXsize, dYsize);
                            }
                            else
                            {
                                oPage.MediaBox = new Aspose.Pdf.Rectangle(
                                    0,
                                    0,
                                    ((Aspose.Imaging.Image)m_oDocument).Width,
                                    ((Aspose.Imaging.Image)m_oDocument).Height);
                                oPage.CropBox = new Aspose.Pdf.Rectangle(
                                    0,
                                    0,
                                    ((Aspose.Imaging.Image)m_oDocument).Width,
                                    ((Aspose.Imaging.Image)m_oDocument).Height);
                            }
                        }
                        else
                        {
                            if ((((Aspose.Imaging.Image)m_oDocument).Width > oPage.PageInfo.Width)
                                && (((Aspose.Imaging.Image)m_oDocument).Height > oPage.PageInfo.Height))
                            {
                                oPage.MediaBox = new Aspose.Pdf.Rectangle(0, 0, dXsize, dYsize);
                                oPage.CropBox = new Aspose.Pdf.Rectangle(0, 0, dXsize, dYsize);
                            }
                            else
                            {
                                oPage.PageInfo.Width = ((Aspose.Imaging.Image)m_oDocument).Width;
                                oPage.PageInfo.Height = ((Aspose.Imaging.Image)m_oDocument).Height;

                                oPage.MediaBox = new Aspose.Pdf.Rectangle(
                                    0,
                                    0,
                                    ((Aspose.Imaging.Image)m_oDocument).Width,
                                    ((Aspose.Imaging.Image)m_oDocument).Height);
                                oPage.CropBox = new Aspose.Pdf.Rectangle(
                                    0,
                                    0,
                                    ((Aspose.Imaging.Image)m_oDocument).Width,
                                    ((Aspose.Imaging.Image)m_oDocument).Height);
                            }
                        }

                        Aspose.Pdf.Image oImage = new Aspose.Pdf.Image();

                        oPage.Paragraphs.Add(oImage);
                        oImage.ImageStream = new MemoryStream(oMTempStream.ToArray());
                        oPdf.Save("result.pdf");
                    }

#55

Ok we are trying and this new option solve one of the problem reguarding pds exports quality. Unfortunately only this one on “presentazione generale ritaglioLight.psd”, other cases remain to solve.
thanks


#56

@BooleServer,

I have observed your comments and request you to please share the other source PSD files along generated and desired outputs that we may verify further on our end.