Free Support Forum - aspose.com

Specify Page Size when Converting to Images

Hi,

How can I specify the page size (A4, Letter, Legal...etc) when converting document pages into images for Excel, PowerPoint, Word, Visio, and MS Project.

Thanks

Hi Scott,


I am representing Aspose.Slides.

Please use the code snippet given below to set the slide size and orientation.

PresentationEx pres = new PresentationEx();

pres.SlideSize.Type = SlideSizeTypeEx.A4Paper;
//pres.SlideSize.Type = SlideSizeTypeEx.Ledger ;

pres.SlideSize.Type = SlideSizeTypeEx.Ledger;

pres.Write (“D:\Aspose Data\Test.pptx”);
Many Thanks,

Hi,


Please see the following code segment on how to specify the page size while converting Excel sheet(s) pages to image files using Aspose.Cells product:

Workbook book = new Workbook(“e:\test\testjm.xls”);



ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.ImageFormat = ImageFormat.Png;
Worksheet sheet = book.Worksheets[0];
sheet.PageSetup.PaperSize = PaperSizeType.PaperA4; // You may try other page sizes using PaperSizeType enum.
SheetRender sr = new SheetRender(sheet, imgOptions);
for (int j = 0; j < sr.PageCount; j++)
{

sr.ToImage(j, “e:\test\testimage_” + sheet.Index + j + “.png”);
}

Also check the documents for your further reference:
http://www.aspose.com/docs/display/cellsnet/Setting+Page+Options
http://www.aspose.com/docs/display/cellsnet/Converting+Worksheet+to+Image

Hi Scott,

Thanks for your query. Please use the following code snippet to specify paper size.

<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>PL</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>AR-SA</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<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-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; 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-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>

Document doc = new Document(MyDir + "input.docx");

foreach (Section section in doc)

section.PageSetup.PaperSize = Aspose.Words.PaperSize.Letter;

doc.Save(MyDir + "Letter.tiff");

Please read following documentation links for your kind reference.

PaperSize Enumeration
http://www.aspose.com/docs/display/wordsnet/Changing+Page+Setup+for+Whole+Document
http://www.aspose.com/docs/display/wordsnet/PageInfo+Members

Hope this answers your query. Please let us know, If you have any more queries.

Hi Scott,

Aspose.Diagram for .NET allows you set width and height of the page but you cannot use pre-defined page sizes at the moment. A new issue to support this feature has been logged into our issue tracking system as DIAGRAM-33185. We will keep you updated on this issue in this thread. In the meantime, you can use the following code.

diagram.Pages[0].PageSheet.PageProps.PageHeight.Value = 8;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

diagram.Pages[0].PageSheet.PageProps.PageWidth.Value = 11;

Best Regards,

Hi Scott,

At the moment, you can set the width and height of the page in pixels while rendering the project to Gantt chart image. A new issue to support pre-defined page sizes has been logged into our issue tracking system as TASKS-33157. We will keep you updated on this issue in this thread.

Best Regards,

The issues you have found earlier (filed as DIAGRAM-33185) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as TASKS-33157) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.