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

Free Support Forum - aspose.com

Aspose.Words Cover Picture as Metadata

Hi Andrey

Hope you're well.

From what I've heard the cover picture metadata feature won't be available until August. I have to say that I'm rather disappointed as we were told it would be available in June in v10.1.

Not having this feature is causing us some headaches.

Two questions:
- why were we told June and it is now going to be August?
- is there something you can do to get us this feature earlier than August?

If nothing at all can be done in providing this feature ASAP, we at least need a solution to the problem we have will when we convert to EPUB, we had a new page with an image. However the image over laps the first page, but with PDF it works fine.

I look forward to hearing from you.

Thanks

Adam Oskwarek

Hi Adam,

Thanks for your request.

1. Please note, that all estimates we provide in the forum are rough estimates and you cannot 100% rely on them.

2. As I mentioned the estimates are rough. So if the feature will be ready earlier we will immediately let you know.

Regarding the first page as image, have you tried to insert the image into a separate section and use DocumentSplitCriteria.PageBreak upon creating EPUB document.

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.saving.htmlsaveoptions.documentsplitcriteria.html

I think this should help you to resolve the problem with overlapping content. If not, please attach your document, the image and code here for testing.

Best regards,

Below is the code which is adding the image. I have tried adding a page break after the image insert and it creates a blank page for the PDF, but appears to be correct for Epub. I dont want to have to write different code for each output. Am I missing a trick?

// Create Aspose.Words.Document and DocumentBuilder.
DocumentBuilder builder = new DocumentBuilder(doc);

// Read the image from file, ensure it is disposed.
using (Image image = Image.FromFile(inputFileName))
{
// Get the number of frames in the image.
int framesCount = image.GetFrameCount(FrameDimension.Page);

// Loop through all frames.
for (int frameIdx = 0; frameIdx < framesCount; frameIdx++)
{
// Insert a section break before each new page, in case of a multi-frame TIFF.
if (frameIdx != 0)
builder.InsertBreak(BreakType.SectionBreakNewPage);

// Select active frame.
image.SelectActiveFrame(FrameDimension.Page, frameIdx);

// We want the size of the page to be the same as the size of the image.
// Convert pixels to points to size the page to the actual image size.

PageSetup ps = builder.PageSetup;
ps.PageWidth = ConvertUtil.PixelToPoint(image.Width, image.HorizontalResolution);
ps.PageHeight = ConvertUtil.PixelToPoint(image.Height, image.VerticalResolution);

// Insert the image into the document and position it at the top left corner of the page.
builder.InsertImage(image, RelativeHorizontalPosition.Page,0,RelativeVerticalPosition.Page,0,ps.PageWidth,ps.PageHeight,WrapType.None);
}
}

Hi Adam,

Thanks for this additional information.

This issue is probably caused because the title image is being inserted as floating content. Positioning floating content is not fully correct when exporting to HTML based formats. Instead I suggest using something like the code below instead, this should appear correctly in all formats. Note that the split option is not required if you are using this code.

// Insert image as inline<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

builder.InsertImage(image, ps.PageWidth, ps.PageHeight);

builder.InsertBreak(BreakType.SectionBreakContinuous);

// Reduce margins in the first section.

PageSetup firstPs = doc.FirstSection.PageSetup;

firstPs.LeftMargin = 0;

firstPs.RightMargin = 0;

firstPs.TopMargin = 0;

firstPs.BottomMargin = 0;

If you are still having troubles, could you please attach your document and image here for testing?

Thanks,

Many thanks. This apperas to work. However now I have seam to have a margin at the top of the first page.

Code
****
using (Image image = Image.FromFile(inputFileName))
{
PageSetup ps = builder.PageSetup;
ps.PageWidth = ConvertUtil.PixelToPoint(image.Width, image.HorizontalResolution);
ps.PageHeight = ConvertUtil.PixelToPoint(image.Height, image.VerticalResolution);

// Insert image as inline
builder.InsertImage(image, ps.PageWidth, ps.PageHeight);
builder.InsertBreak(BreakType.SectionBreakContinuous);

// Reduce margins in the first section.
PageSetup firstPs = doc.FirstSection.PageSetup;
firstPs.LeftMargin = 0;
firstPs.RightMargin = 0;
firstPs.TopMargin = 0;
firstPs.BottomMargin = 0;
}

Hi Adam,

Thanks for this additional information.

I'm afraid I can't reproduce this issue using a simple test on my side. Could you please attach your document and image here for testing? I will take a closer look into this for you.

Thanks,

Hi Adam,

Thanks for supplying your input documents. The issue is occuring because the image is being inserted into the same paragraph as the title. This title is styled with Heading 1 style which has spacing before. This spacing pushes the image down. An easy way to avoid this is to insert a new paragraph and reset any style or line spacing. Please see the fix to the code below.

// Insert a blank paragraph<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

builder.Writeln();

builder.MoveToDocumentStart();

// Reset paragraph format on this paragraph.

builder.CurrentParagraph.ParagraphFormat.StyleIdentifier = StyleIdentifier.Normal;

builder.CurrentParagraph.ParagraphFormat.SpaceBefore = 0;

builder.CurrentParagraph.ParagraphFormat.SpaceAfter = 0;

// Insert image as inline

builder.InsertImage(image, ps.PageWidth, ps.PageHeight);

builder.InsertBreak(BreakType.SectionBreakContinuous);

Also note that you should do something with this part of your code below or else you will insert an unneeded page break. You can either remove these lines or move the builder.InsertBreak(BreakType.SectionBreak) line to here instead. Remember the break type must be a section break in order to separate the different margins.

if (strBookCoverFileName != null)

{

docbuilder.InsertBreak(BreakType.PageBreak);

samplebuilder.InsertBreak(BreakType.PageBreak);

}

Thanks,

The issues you have found earlier (filed as WORDSNET-3908) have been fixed in this .NET update and in this Java update.


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