Frequently Asked Question

Show the first page as single page in double page horizontal mode
Last Updated 11 months ago

In PDFView.m, vopen() method, you should add bool *horzs before switch(g_def_view) like this:

bool *verts = (bool *)calloc( sizeof(bool), [doc pageCount] );
bool *horzs = (bool *)calloc( sizeof(bool), [doc pageCount] );
for (int i = 0; i < m_doc.pageCount; i++) {
    if (i > 0) {
        horzs[i] = true;
    }
}
switch(g_def_view)
{

then, you have to modify the m_view initialization in this way:

For g_def_view = 3:
m_view = [[PDFVDual alloc] init:false :NULL :0 :horzs :m_doc.pageCount];

instead of:

m_view = [[PDFVDual alloc] init:false :NULL :0 :NULL :0];

For g_def_view = 4:

m_view = [[PDFVDual alloc] init:true :NULL :0 :horzs :m_doc.pageCount];

instead of:

m_view = [[PDFVDual alloc] init:true :NULL :0 :NULL :0];

For versions 3.3.0+ (for paging support) you should modify also the vGoto:(int)pageno method, in PDFView class, in this way:

-(void)vGoto:(int)pageno
{
    if (doublePage) {
        if (g_paging_enabled && g_def_view == 4 && pageno > 0 && (pageno + 1) < m_doc.pageCount && (pageno % 2 != 0) && !UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) {
            pageno++;
        }
        
        if (g_paging_enabled && g_def_view == 3 && pageno > 0 && (pageno % 2 == 0) && !UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) {
            pageno--;
        }
    }

    struct PDFV_POS pos;
    
    pos.x = 0;
    pos.y = [m_doc pageHeight:pageno];
    pos.pageno = pageno;
    int pages = (!UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]) && doublePage && m_doc.pageCount > 1 && pageno > 0) ? 2 : 1;
    float gapX = (m_w - (([m_doc pageWidth:pageno] * pages)*[m_view vGetScaleMin])) / 2;
    float gapY = (m_h - ([m_doc pageHeight:pageno]*[m_view vGetScaleMin])) / 2;
    
    if (g_def_view > 1)
        [m_view vSetPos:&pos :gapX :gapY];
    else
        [m_view vSetPos:&pos :0 :0];
    
    CGPoint pt;
    pt.x = [m_view vGetX]/m_scale;
    pt.y = [m_view vGetY]/m_scale;
    
    self.contentOffset = pt;
        
    [self refresh];
}


Loading ...