Skip to content

Commit

Permalink
PDF file signature check
Browse files Browse the repository at this point in the history
  • Loading branch information
vfr committed Oct 12, 2012
1 parent 962f8d3 commit 3548ea1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Reader.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
8D1107310486CEB800E47090 /* Reader-Info.plist */,
4541A9D7122EA716001A5E60 /* Localizable.strings */,
45AB72DF141FC04B003524C3 /* README.md */,
45D5AD9E1610E66B00706B9A /* HISTORY.md */,
45AB72DD141FC043003524C3 /* LICENSE.md */,
8D1107310486CEB800E47090 /* Reader-Info.plist */,
4541A9D7122EA716001A5E60 /* Localizable.strings */,
45AB72DB141FC039003524C3 /* Reader.pdf */,
);
name = Resources;
Expand Down
11 changes: 3 additions & 8 deletions Sources/ReaderDocument.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ReaderDocument.m
// Reader v2.6.0
// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -179,16 +179,11 @@ + (BOOL)isPDF:(NSString *)filePath

if (fd > 0) // We have a valid file descriptor
{
const unsigned char sig[4]; // File signature
const char sig[1024]; // File signature buffer

ssize_t len = read(fd, (void *)&sig, sizeof(sig));

if (len == 4)
if (sig[0] == '%')
if (sig[1] == 'P')
if (sig[2] == 'D')
if (sig[3] == 'F')
state = YES;
state = (strnstr(sig, "%PDF", len) != NULL);

close(fd); // Close the file
}
Expand Down

6 comments on commit 3548ea1

@Rajios
Copy link

@Rajios Rajios commented on 3548ea1 Nov 5, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
I m new to ios
I need the latest version without ARC or can u suggest the version number

@t89
Copy link

@t89 t89 commented on 3548ea1 Jan 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A search function would be really usefull. I've been working on one but got stuck in your Scanner... :/

@engkhaled
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi
i would like to use this source code in my project
but i have one problem i wanna make pdf view Display pdf from right to left
not Left to right can you help me plz?
thanks in advance

@mlibary
Copy link

@mlibary mlibary commented on 3548ea1 Feb 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi;

Thank you for this useful open source code, but I have one question only :)

I want the book to start navigating from Right to Left (Like an Arabic book).
How can I do that ?!

Thanks in advance :)

@kiroskirin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, how can I add page flip effect of UIPageViewController to this good open source.

Thanks you.

@obaidjawad
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mlibary have you attained the functionality from right to left for an arabic book if yes please share it with me as I'm also stuck to it.

Please sign in to comment.