Free Support Forum - aspose.com

IsFirstPageOnly ... make header margin space smaller on 2nd-3rd pages

I am usting the IsFirstPageOnly=“true”

This is fine on the first page.
But on the second and third pages that are large spaces where the header is on the first page.
I need to somehow remove this space!
Is there a release out there that will have an option to fix this??

thanks


Dear charmer,

Thank you for considering Aspose.

Aspose.Pdf use the page’s top margin to display page header. When the header is larger than the page’s top margin, the top margin of page will be enlarged. All pages in a section share the same top margin, so when the top margin of the first page is enlarged, the top margin of subsequent pages is also enlarged. I will solve this problem in one or two days.

Dear charmer,

Thank you for considering Aspose.

I found it is not easy to solve this problem because all pages in a section share the same top margin. As for your report, I think you can set the top margin smaller and set the header table as the first paragraph in the section.

If we set the header as the first table in the section, will we still be able to use the IsFirstPageOnly property? We only want the header to appear on the first page.

Dear charmer,

Thank you for considering Aspose.

If you set the header table as the first table in the section, then you need not use header again. That means you don’t use header, but take the header table as a normal paragraph.

You have another choice. You can use two sections. The firsrt section has header and footer but no paragraph. The second section has all paragraphs but no header. Note that you should set the you should set the “IsNewPage” property to false so that the second section will not start a new page. Then the header in the first section will not affect the second section.

Here is an example XML:

<?xml version="1.0" encoding="utf-8"?>



This is line1
This is line2
This is line3
This is line4
This is line5
This is line1
This is line2
This is line3
This is line4
This is line5


This is line1
This is line2
This is line3
This is line4
This is line5
This is line1
This is line2
This is line3
This is line4
This is line5



Hello1 world Hello world this is a test for word space. Is it all right now?
Hello2 world Hello world




I’m trying to set up two different sections like you suggested, but my first section is not showing up on the PDF.
Any suggestions?

Here is the code:

<xsl:template match=“text()|a:*”>


<xsl:call-template name=“Header” />


<xsl:call-template name=“FooterAlternate”/>
xsl:choose
<xsl:when test="$ReportType=1">
<xsl:apply-templates select="/a:ProductsDataSet/a:Region[(a:RegionCode=(/a:ProductsDataSet/a:AllKeys[(count(. | key(‘Region’, RegionCode)[1])=1) and (a:CommClassCode=1) and (a:HouseID=$HouseID) and (a:CurrentOrNew=$CurrentOrNew) ]/a:RegionCode))]">
<xsl:sort data-type=“text” order=“ascending” select="/a:ProductsDataSet/a:Region[(a:RegionCode=(/a:ProductsDataSet/a:AllKeys[(count(. | key(‘Region’, RegionCode)[1])=1) and (a:CommClassCode=1) and (a:HouseID=$HouseID) and (a:CurrentOrNew=$CurrentOrNew) ]))]/a:RegionName"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="$ReportType=2">
<xsl:apply-templates select="/a:ProductsDataSet/a:Region[(a:RegionCode=(/a:ProductsDataSet/a:AllKeys[(count(. | key(‘Region’, RegionCode)[1])=1) and (a:CommClassCode=1) and (a:HouseID=$HouseID) and (a:CurrentOrNew=$CurrentOrNew) and ((a:RegionGroupCode!=11) and (a:RegionGroupCode!=10) and (a:RegionGroupCode!=7) and (a:RegionGroupCode!=6) and (a:RegionGroupCode!=5))]/a:RegionCode))]">
<xsl:sort data-type=“text” order=“ascending” select="/a:ProductsDataSet/a:Region[(a:RegionCode=(/a:ProductsDataSet/a:AllKeys[(count(. | key(‘Region’, RegionCode)[1])=1) and (a:CommClassCode=1) and (a:HouseID=$HouseID) and (a:CurrentOrNew=$CurrentOrNew) and ((a:RegionGroupCode!=11) and (a:RegionGroupCode!=10) and (a:RegionGroupCode!=7) and (a:RegionGroupCode!=6) and (a:RegionGroupCode!=5))]))]/a:RegionName"/>
</xsl:apply-templates>
</xsl:when>
xsl:otherwise
<xsl:apply-templates select="/a:ProductsDataSet/a:Region[(a:RegionCode=(/a:ProductsDataSet/a:AllKeys[(count(. | key(‘Region’, RegionCode)[1])=1) and (a:CommClassCode=1) and (a:HouseID=$HouseID) and (a:CurrentOrNew=$CurrentOrNew) and (a:CategoryCode!=18) and (a:RegionGroupCode=$RegionGroupCode)]/a:RegionCode))]">
<xsl:sort data-type=“text” order=“ascending” select="/a:ProductsDataSet/a:Region[(a:RegionCode=(/a:ProductsDataSet/a:AllKeys[(count(. | key(‘Region’, RegionCode)[1])=1) and (a:CommClassCode=1) and (a:HouseID=$HouseID) and (a:CurrentOrNew=$CurrentOrNew) and (a:CategoryCode!=18) and (a:RegionGroupCode=$RegionGroupCode)]))]/a:RegionName"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>


</xsl:template>


<xsl:template name=“Header”>
<xsl:variable name=“HouseLogo” select=“concat($LogoImageDir,/a:ProductsDataSet/a:States[(normalize-space(a:StateCode)=normalize-space($StateCode))]/a:StateLogoFileName)”/>
<xsl:variable name=“DefaultHouseLogo” select=“concat($LogoImageDir,‘ReportLogo_TCSG.jpg’)”/>







<xsl:if test=“string($LogoImageDir)”>

<xsl:attribute name=“File”>
<xsl:copy-of select="$HouseLogo" />
</xsl:attribute>
<xsl:attribute name=“DefaultFile”>
<xsl:copy-of select="$DefaultHouseLogo" />
</xsl:attribute>

</xsl:if>







</xsl:template>

Dear charmer,

Thank you for considering Aspose.

I can’t find any error in your code. Would you please send your complete code (including the xslt,xml and images) to me?



I’ve attached the requested files to an email and sent them to pdf@aspose.com. I referenced this posting in the email. Let me know if you need more information from me.

Dear charmer,

Thank you for considering Aspose.

I have tested your code and found that it seemed the first section is now shown because the image in the header is not found and you set the IsImageNotFoundErrorIgnored to true. In fact, the header is displayed but there is no content. When I changed the image path, the header displayed.

When I use only one section, the header including the image is shown. Why would using two sections prevent the image from showing up?

Dear charmer,

Thank you for considering Aspose.

Would you please try adding a text paragraph in you header and see whether the text can be displayed?

The header still will not show up. I changed the Header to this :

<xsl:template name=“Header”>






This is a test.






</xsl:template>

The text is showing up in the xml file. I’m attaching the file to an email for your review.

Dear charmer,

Thank you for considering Aspose.

Would you please tell me how to test your xsl file? Do you have another xml file that contains data? Please send me all your files so that I can reproduce the error.