Document pdfDoc = new Document();
PdfFileEditor pdfFileEditor = new PdfFileEditor();
//pdfDoc.OptimizeResources(GetAsposeOptimizationOption());
int tempPagecnt = pdfDocTemp.Pages.Count;
int[] cnt = new int[tempPagecnt];
for (int tempPageCount = 1; tempPageCount <= tempPagecnt; tempPageCount++)
{
pdfDoc.Pages.Add(pdfDocTemp.Pages[tempPageCount]);
cnt[tempPageCount - 1] = tempPageCount;
}
// Resize contents of resultant PDF
pdfFileEditor.ResizeContents(pdfDoc, cnt, PdfFileEditor.ContentsResizeParameters.PageResize(Aspose.Pdf.PageSize.PageLetter.Width, Aspose.Pdf.PageSize.PageLetter.Height));
I resized a scanned pdf file, but the width and height is saved oppositely.
It looks like a bug.
How can I do for this?
If there is no method, I want to know a property can check this pdf file is scanned file or not.
@koreaus1,
Can you provide the example file where this happened?
I tested your code:
private void Logic(Document source)
{
Document target = new Document();
PdfFileEditor pdfFileEditor = new PdfFileEditor();
int tempPagecnt = source.Pages.Count;
int[] cnt = new int[tempPagecnt];
for (int tempPageCount = 1; tempPageCount <= tempPagecnt; tempPageCount++)
{
target.Pages.Add(source.Pages[tempPageCount]);
cnt[tempPageCount - 1] = tempPageCount;
}
// Resize contents of resultant PDF
pdfFileEditor.ResizeContents(target, cnt, PdfFileEditor.ContentsResizeParameters.PageResize(Aspose.Pdf.PageSize.PageLetter.Width, Aspose.Pdf.PageSize.PageLetter.Height));
}
Input, Output files:
ScallingHeightWeightInverted_input.pdf (146.3 KB)
ScallingHeightWeightInverted_output.pdf (146.3 KB)
I can not share this pdf file… I`m sorry, but can you test again at aspose.pdf 21.8 version?
@koreaus1,
We suggest you update your Aspose library version.
As it is 2 major versions behind the current code. Even if the error is present in that old version, there is nothing to do with it, since all fixes are done in the latest versions.
Landscape Test2.pdf (2.5 MB)
please test again this pdf file?
@koreaus,
It works fine, but it is confusing you name the file landscape when is portrait.
![](https://forum.aspose.com/uploads/default/74136)
That how the document opens in adobe acrobat.
Can you give me the resized file?
Hi… Did you test this source and Landscape Test2.pdf (2.5 MB) file?
I tested it using aspose.pdf 23.2 version, but landscape is displayed… Landscape Test2_result.pdf (855.9 KB)
Document pdfDoc = new Document();
PdfFileEditor pdfFileEditor = new PdfFileEditor();
//pdfDoc.OptimizeResources(GetAsposeOptimizationOption());
int tempPagecnt = pdfDocTemp.Pages.Count;
int[] cnt = new int[tempPagecnt];
for (int tempPageCount = 1; tempPageCount <= tempPagecnt; tempPageCount++)
{
pdfDoc.Pages.Add(pdfDocTemp.Pages[tempPageCount]);
cnt[tempPageCount - 1] = tempPageCount;
}
// Resize contents of resultant PDF
pdfFileEditor.ResizeContents(pdfDoc, cnt, PdfFileEditor.ContentsResizeParameters.PageResize(Aspose.Pdf.PageSize.A4.Width, Aspose.Pdf.PageSize.A4.Height));
@koreaus1,
The issue I have with your post is that it is incomplete, so I have to guess what is pdfDoc or where it came from, was it modified? So, can you add the complete snippet?
Copy your code and you will see what are you missing. With the whole snippet I can try to replicate and if I guet the same result as you I will create a ticket for the dev team.