or
private void Process_Tiff(BookView wpfbook, string TempFile)
{
RemoveOldFiles();
//Sets each page to an image
Image img = Image.FromFile(TempFile);
int count = img.GetFrameCount(FrameDimension.Page);
List<
BookItem
> MyBook = new List<
BookItem
>();
for (int idx = 0; idx < count; idx++)
{
img.SelectActiveFrame(FrameDimension.Page, idx);
int currentpage = idx + 1;
string TempPageFile = DefaultPath + DocOcc.ToString() + currentpage.ToString() + ".TIFF";
// and then create a new Image from it
img.Save(TempPageFile);
dFile df = new dFile();
df.File_Path = TempPageFile;
FileList.Add(df);
MyBook.Add(new BookItem()
{
Title = TempPageFile
});
}
img.Dispose();
wpfbook.RadBook1.ItemsSource = MyBook;
}
private void RemoveOldFiles()
{
((BookView)((ElementHost)panel1.Controls[0]).Child).RadBook1.ItemsSource = null;
int count = 0;
IList<
dFile
> holddf = new List<
dFile
>();
foreach (dFile dfrow in FileList)
{
try
{
File.Delete(dfrow.File_Path);
count++;
}
catch
{
dFile df = new dFile();
df.File_Path = dfrow.File_Path;
holddf.Add(df);
count++;
}
}
FileList = holddf;
}
Hi, there.
I think RadBook is a great component for document viewer.
The problem is that I need to change the Width and Height of the viewer and the contents need to reformat the pages to fit in.
I tested code based on "RadBookIntegration" sample by adding the follwoing code.
private void RadButtonIncrease_Click(object sender, RoutedEventArgs e) { RadDocument doc = this.viewManager.Document; doc.DefaultPageLayoutSettings.Width += 50; doc.DefaultPageLayoutSettings.Height += 50; doc.UpdateLayout(); } private void RadButtonDecrease_Click(object sender, RoutedEventArgs e) { RadDocument doc = this.viewManager.Document; doc.DefaultPageLayoutSettings.Width -= 50; doc.DefaultPageLayoutSettings.Height -= 50; doc.UpdateLayout(); }
I believe UpdateLayout should reformat the contents but the result is not what I expected; page numbers and contents gets duplicated.
Can you please tell me what I'm doing wrong?
Thanks for your help.