| 
			
			 | 
		#1 | 
| 
			
			
			
			 my parent's oops... 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 493 
				Karma: 1477572 
				Join Date: Feb 2009 
				
				
				
				Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->L2->iOS/CBW 
				
				
				 | 
	
	
	
		
		
			
			 
				
				page-template.xpgt conversion problems in ePub
			 
			
			
			OK, I have had some issues in the ePub to ePub conversions. Several books that were originally created with adobe software are not behaving when it comes to conversion css overrides in calibre. Usually, I just delete the css stylesheet in the original ePub and this makes it all better. However, I now have an ePub that has a "page-template.xpgt" file that implements justification and margins that I don't like. I can access this file from within calibre or sigil for tweaking, but if I just delete it from the ePub, it hangs my reader after conversion. Is there a simple, quick (even if dirty) way of getting rid of this template from my ePub that allows me to apply the css override during conversion? I have put the code from the template below: 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Code: 
	<?xml version='1.0' encoding='utf-8'?>
<ade:template xmlns="http://www.w3.org/1999/xhtml" xmlns:ade="http://ns.adobe.com/2006/ade" xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
  <fo:simple-page-master master-name="single_column">
    <fo:region-body margin-bottom="1.5em" margin-top="1.5em" margin-left="1.5em" margin-right="1.5em"/>
    </fo:simple-page-master>
    <fo:simple-page-master master-name="two_column" margin-bottom="1em" margin-top="1em" margin-left="1em" margin-right="1em">
    <fo:region-body column-count="2" column-gap="10pt"/>
    </fo:simple-page-master>
    <fo:simple-page-master master-name="two_column_head" margin-bottom="1em" margin-top="1em" margin-left="1em" margin-right="1em">
    <fo:region-before extent="8.3em"/>
    <fo:region-body column-count="2" column-gap="10pt"/>
    </fo:simple-page-master>
    <fo:simple-page-master master-name="three_column" margin-bottom="0.5em" margin-top="0.5em" margin-left="0.5em" margin-right="0.5em">
    <fo:region-body column-count="3" column-gap="10pt"/>
    </fo:simple-page-master>
    <fo:simple-page-master master-name="three_column_head" margin-bottom="0.5em" margin-top="0.5em" margin-left="0.5em" margin-right="0.5em">
    <fo:region-before extent="8.3em"/>
    <fo:region-body column-count="3" column-gap="10pt"/>
    </fo:simple-page-master>
    <fo:page-sequence-master>
        <fo:repeatable-page-master-alternatives>
            <fo:conditional-page-master-reference master-reference="three_column_head" page-position="first" ade:min-page-width="80em"/>
            <fo:conditional-page-master-reference master-reference="three_column" ade:min-page-width="80em"/>
            <fo:conditional-page-master-reference master-reference="two_column_head" page-position="first" ade:min-page-width="50em"/>
            <fo:conditional-page-master-reference master-reference="two_column" ade:min-page-width="50em"/>
            <fo:conditional-page-master-reference master-reference="single_column"/>
        </fo:repeatable-page-master-alternatives>
    </fo:page-sequence-master>
  </fo:layout-master-set>
  <ade:style>
    <ade:styling-rule selector=".title_box" display="adobe-other-region" adobe-region="xsl-region-before"/>
  </ade:style>
</ade:template>
 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Comparer of the Ephemeris 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,496 
				Karma: 424697 
				Join Date: Mar 2009 
				
				
				
				Device: iPad 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			When you removed it from the ePub, did you also remove references to it from the OPF file? 
		
	
		
		
		
		
		
		
		
		
		
		
	
	G  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#3 | 
| 
			
			
			
			 my parent's oops... 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 493 
				Karma: 1477572 
				Join Date: Feb 2009 
				
				
				
				Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->L2->iOS/CBW 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thanks, I forgot to do that. So, in the end, I deleted the stylesheet, the page-template.pgxt, removed the reference in the opf file, and then converted in calibre with my css override. Annoying, not the cleanest file/workflow, but it worked. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Thanks for your assistance.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 US Navy, Retired 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,897 
				Karma: 13806776 
				Join Date: Feb 2009 
				Location: North Carolina 
				
				
				Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I may be wrong, but for future reference I thought if you deleted the page-template.pgxt file via Sigil then saved the epub, that Sigil updates the other references.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 my parent's oops... 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 493 
				Karma: 1477572 
				Join Date: Feb 2009 
				
				
				
				Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->L2->iOS/CBW 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 US Navy, Retired 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,897 
				Karma: 13806776 
				Join Date: Feb 2009 
				Location: North Carolina 
				
				
				Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,782 
				Karma: 150249619 
				Join Date: Nov 2006 
				Location: Roslindale, Massachusetts 
				
				
				Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#8 | 
| 
			
			
			
			 HackJOB 
			
			![]() Posts: 17 
				Karma: 10 
				Join Date: Feb 2011 
				
				
				
				Device: Nook Color, iPad, Android(Epic), PC. 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I am using Sigil( I have calibre also), and when I removed the .xpgt file and removed the xhtml links, it loaded on Nook and adobe digital editions just fine. i didn't know about an OPF retaining info. I use Calibre for checking code and epub. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Is having this .xpgt file a must for iPad and iPhone devices?  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#9 | 
| 
			
			
			
			 my parent's oops... 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 493 
				Karma: 1477572 
				Join Date: Feb 2009 
				
				
				
				Device: Vx->Handera->Clie-> Axim->505->650->KPW/Aura ->L2->iOS/CBW 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I have no idea if it is necessary for the ipad/iphone devices since I actually don't have either. If you don't want to delete it, you can also simply change the code of the file which is also quite easy to do - just open in an editor. For example, my issues were the huge margins showing up on my sony reader so I looked in the file and changed the margins on the section that described how a single column is supposed to be shown.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#10 | |
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,782 
				Karma: 150249619 
				Join Date: Nov 2006 
				Location: Roslindale, Massachusetts 
				
				
				Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#11 | 
| 
			
			
			
			 Connoisseur 
			
			![]() ![]() Posts: 99 
				Karma: 170 
				Join Date: Nov 2010 
				Location: Airdrie Alberta 
				
				
				Device: Sony 650 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I exploded the epub then deleted the css file and the page-template.xpgt file. I then rebuilt the epub and reconverted to epub with my settings in Preferences/ Common Options. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	the book is working fine on my Sony 650 so far. Am I just lucky? Some people are also saying to delete the references in the opf file In the opf file then you just delete these lines ? Spoiler: 
 and some say they even go as far as deleting references in the xml/html files. and in each html file delete ? Spoiler: 
 Is this correct. It seems like a lot of extra work each time I want a book to look the way I want. Thanks  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#12 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657 
				Karma: 64171 
				Join Date: Sep 2010 
				Location: Kent, England, Sol 3, ZZ9 plural Z Alpha 
				
				
				Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin) 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			It'll be fine for your own purposes, but if your publishing for others then you will need to clean it up and validate it.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#13 | 
| 
			
			
			
			 Connoisseur 
			
			![]() ![]() Posts: 99 
				Karma: 170 
				Join Date: Nov 2010 
				Location: Airdrie Alberta 
				
				
				Device: Sony 650 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			When  you say clean up, you mean by stripping the references to css and page-template.xpgt in the opf file and xml/html files correct ? 
		
	
		
		
		
		
		
		
		
		
		
		
		
			Why would that not validate afterwards ? I just exploded a book I had previously done and a css file is back. Looks like Calibre inserted one but if I remove the links to it now what will happen. CSS Spoiler: 
 What does .calibre2 thru calibre5 stand for ? .calibre is my font settings etc .calibre1 is no space between paragraphs I THINK What are the rest ? I want to get my books looking the way I like but I do not want to screw it up for anyone else. Is it not better to replace the css file with my own (the one calibre made for me in this instance) and just get rid of page-template.xpgt and any references to that ? OK now I really am confused. On checking opf/html files of a book I previously exploded, and deleted the page-template.xpgt and css files, I now find another css file (calibres) but all references in the html files and opf files to page-template.xpgt are gone. Also each html file even though having still a link to stylesheet1.css, my styles created in calibre are in the head of each page. Has Calibre become even more sophisticated lately ? Kudos if so. Last edited by mufc; 03-09-2011 at 08:46 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#14 | 
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,782 
				Karma: 150249619 
				Join Date: Nov 2006 
				Location: Roslindale, Massachusetts 
				
				
				Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			When you have a page-template file, delete it. Then in each XML file, delete the reference to it. Also delete the reference to it in the OPF file. I use notepad++ and this makes it very easy to handle this for however many XML files there are. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	As for the CSS, deleting it is a rather bad idea. Take the CSS and edit it to make the ePub look how you want it to look. That way, you won't lose things like italics, bold, font sizes and other things. You will have to look in the XML files to see what CSS entries you may want to edit. I do this a lot and overall, it's not difficult to do.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#15 | 
| 
			
			
			
			 Connoisseur 
			
			![]() ![]() Posts: 99 
				Karma: 170 
				Join Date: Nov 2010 
				Location: Airdrie Alberta 
				
				
				Device: Sony 650 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I think you will find that when you explode the epub and delete the page-template file and then rebuild the epub that calibre removes all references to it. Try it by exploding the epub again. Also you can do the same with the css file because Calibre builds a new one from what you put in Preferences/ Common Options
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
            
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| [Old Thread] epub -> mobi conversion; blank page after image | joubert | Calibre | 10 | 03-07-2011 06:26 PM | 
| epub to mobi conversion problems | rcdc | Calibre | 5 | 09-18-2010 03:29 AM | 
| epub conversion problems | Reko | Calibre | 0 | 08-24-2010 01:03 AM | 
| LIT to EPUB conversion problems | stratman | Calibre | 3 | 01-28-2010 12:50 PM |