We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Pdf conversion to tiff

Hi,

I am having a pdf document and when i am trying to convert it t osingle page tiff, the image is loosing its quality.
Please see the code and pdf also attached.
Can you please help me on this. It is an urgent issue i need to fix

 public static Image[] ConvertPDFtoMultiPageTiff(string OutputFolder, string FullInputFileName)
{
Image[] sourceImages = null;
        <span style="color:blue;">try</span>
        {

            <span style="color:#2b91af;">Document</span> pdfDocument = <span style="color:blue;">new</span> <span style="color:#2b91af;">Document</span>(FullInputFileName);
           
            <span style="color:green;">//create Resolution object</span>
            <span style="color:#2b91af;">Resolution</span> resolution = <span style="color:blue;">new</span> <span style="color:#2b91af;">Resolution</span>(300);
            <span style="color:green;">//create TiffSettings object</span>
            <span style="color:#2b91af;">TiffSettings</span> tiffSettings = <span style="color:blue;">new</span> <span style="color:#2b91af;">TiffSettings</span>();
            tiffSettings.Compression = <span style="color:#2b91af;">CompressionType</span>.CCITT4;

            tiffSettings.Depth = Aspose.Pdf.Devices.<span style="color:#2b91af;">ColorDepth</span>.Default;
            <span style="color:blue;">if</span>(tiffSettings.Shape == <span style="color:#2b91af;">ShapeType</span>.Landscape)
            tiffSettings.Shape = <span style="color:#2b91af;">ShapeType</span>.Portait;
           
            tiffSettings.SkipBlankPages = <span style="color:blue;">false</span>;
           


            <span style="color:#2b91af;">Stream</span> output = <span style="color:blue;">null</span>;
            sourceImages = <span style="color:blue;">new</span> <span style="color:#2b91af;">Image</span>[pdfDocument.Pages.Count];
            <span style="color:green;">//create TIFF device</span>
            <span style="color:#2b91af;">TiffDevice</span> tiffDevice = <span style="color:blue;">new</span> <span style="color:#2b91af;">TiffDevice</span>(resolution, tiffSettings);
           
            
            <span style="color:blue;">for</span> (<span style="color:blue;">int</span> page = 1; page <= pdfDocument.Pages.Count; page++)
            {

                output = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>();
                <span style="color:green;">//tiffDevice.Process(pdfDocument, page, page, Path.Combine(OutputFolder, String.Concat(Path.GetFileNameWithoutExtension(FullInputFileName), ".",page.ToString().PadLeft(3, '0'))));</span>

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

                sourceImages[page - 1] = <span style="color:#2b91af;">Image</span>.FromStream(output);

                sourceImages[page - 1].Save(<span style="color:#2b91af;">Path</span>.Combine(OutputFolder, <span style="color:#2b91af;">String</span>.Concat(<span style="color:#2b91af;">Path</span>.GetFileNameWithoutExtension(FullInputFileName), <span style="color:#a31515;">"."</span>, page.ToString().PadLeft(3, <span style="color:#a31515;">'0'</span>))));

                output = <span style="color:blue;">null</span>;

            }

        }
        <span style="color:blue;">catch</span> (<span style="color:#2b91af;">Exception</span> ex)
        {
            sourceImages = <span style="color:blue;">null</span>;
            <span style="color:blue;">throw</span> <span style="color:blue;">new</span> <span style="color:#2b91af;">Exception</span>(<span style="color:#2b91af;">String</span>.Format(<span style="color:#a31515;">"Error in splitTiffPages: {0}"</span>, ex.Message));
        }


        <span style="color:blue;">return</span> sourceImages;
    }</pre><br>

Hi Anish,


Thanks for using our products.

I have tested the conversion with Aspose.Pdf for .NET 7.7.0 while using the code snippet which you have shared and I am able to reproduce the problem that formatting of resultant TIFF is not correct (Unable to read text in resultant file). However during my testing I have observed that the problem is occurring due to value of CompressionType that you are using. Please note that in order to correct output image, please try using LZW value from CompressionType. The size of resultant image is increased but the formatting of resultant file is correct.

We are sorry for this inconvenience.

[C#]

Document pdfDocument = new Document(“c:/pdftest/MSGFile.pdf”);<o:p></o:p>

//create Resolution object

Resolution resolution = new Resolution(300);

//create TiffSettings object

TiffSettings tiffSettings = new TiffSettings();

tiffSettings.Compression = CompressionType.LZW;

tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Default;

if (tiffSettings.Shape == ShapeType.Landscape)

tiffSettings.Shape = ShapeType.Portait;

tiffSettings.SkipBlankPages = false;

//create TIFF device

TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);

//convert a particular page and save the image to stream

tiffDevice.Process(pdfDocument, "c:/pdftest/PDF_TIFF_output.tif");

Hi Nayyer,

Here i am attaching one more PDF . Can you please try to convert this to single page PDF images. Because i am not able to convert this pdf properly.

I am using the above mentioned portion of the code.

I tried with latest version of Aspose.pdf V7.9
But still no luck. Can you please help me. Or at least give me some idea.

Regards
Anish

forgot to attach the PDF.

Hi Anish,


As shared over 462368, the problem has been logged in our issue tracking system as PDFNEWNET-35225. The development team will further look into the details of this issue and we will keep you posted on the status of correction. Please be patient and spare us little time.

We are sorry for your inconvenience.

Hi,

Can you able to tel me when this issue can able to fix, Please?
I just want to give an ETA to my customer.

Regards
Anish

Hi Anish,


<span style=“font-size:10.0pt;font-family:“Verdana”,“sans-serif”;
color:#333333”>Since we recently have been able to notice this issue, so until
or unless we have investigated this issue in details and have figured out the
actual reasons of this problem, we might not be able to share any timelines by
which this problem will be resolved.<o:p></o:p>

However, as soon as we have made some significant progress towards the resolution of this issue, we would be more than happy to update you with the status of correction. Please be patient and spare us little time. Your patience and comprehension is greatly appreciated in this regard.

Hi All,

Is there any update on this issue. Please let me know if this issue is fixed.

Regards
Anish

Hi Anish,


Thanks for your patience.

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:“Times New Roman”;color:#333333;background:white;
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>The
development team has been busy resolving other priority issues and I am afraid
this above stated problem is not yet resolved. However as soon as we have made some significant progress towards the resolution of this problem, we would be more than glad to update you with the status of correction.
<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:“Times New Roman”;color:#333333;background:white;
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>
<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:“Times New Roman”;color:#333333;background:white;
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>Please be patient and spare us little time.

Hi Nayyer Shahbaz,

<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

<![endif]–><span style=“font-size:11.0pt;line-height:115%;
font-family:“Calibri”,“sans-serif”;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:“Times New Roman”;mso-bidi-theme-font:minor-bidi;
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>I
think this issue is almost 2 weeks old. Normal we are getting maximum 3 days
delay to resolve an issue. So our customer is keeping on asking me the update
for this.



Is there a chance to say an ETA to our customer to fix this issue?



Hoping you can able to understand my problem.

Regards
Anish


Hi Shahbaz,

My customer is asking an ETA to fix this issue.
So can you please give me an expected date to fix this issue . So that i can send them an update to them.

Regards
Anish

Hi Anish,


Sorry for the inconvenience faced. I’m afraid we can’t provide you an ETA at the moment, as issue is pending for analysis in queue with other priority tasks. However, I’ve shared your concern with the development team and requested to provide an ETA at their earliest. As soon as I get a feedback I’will notify you via this forum thread.

Thanks for your patience and cooperation.

Best Regards,

Hi Tilal,

Is there any update on this issue or i can tel my customer that this issue is not able to fix.
Can you please give me any update.

Regards
Anish

Hi Anish,


Sorry for the inconvenience faced. I’m afraid issue is still not resolved due to other priority tasks. Please be patient and spare us some time. I’ll update you via this forum thread as soon as I get a feedback from our development team.

Thanks for your patience and cooperation.

Best Regards,

Hi Tilal Ahmad,

As a developer i can able to understand the delay.

But can you please let me know a reasonable reply which i can give to my customers.

Regards
Anish

Hi Anish,


Thanks for your feedback. I would like to share that issues are addressed and resolved based on first come first serve basis.We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

Moreover, we can’t provide you an estimate without completion of analysis. Our development team has planned investigation of your reported issue in second week of June. We will provide you our findings/ETA as soon as it is completed.

Thank you for your patience and understanding.

Best Regards,

Hi Tilal Ahmad,

I am expecting a fix for this issue in this week. Waiting for your response.

Thanks and Regards
Anish


Hi Anish,


Thanks for your inquiry. Sorry for any confusion, hopefully our development team will complete the investigation soon and then we will share ETA for the fix.

Thanks for your patience and understanding.

Best Regards,

Hi Tilal,
I can provide you one more pdf which is also showing as blank after converting to Tiff.

Regards
Anish

Hi Anish,


Thanks for your additional information. I would like to update you that our development team has analyzed the issue and hopefully issue will be resolved in upcoming release of Aspose.Pdf for .NET 8.2.0. However we will notify you via this forum thread as soon as its released and gets available for download.

Thanks for your patience and cooperation.

Best Regards,