Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

PDF file signature check

  • Loading branch information...
commit 3548ea14e488fe92ce43f1c579962ae6a5b39445 1 parent 962f8d3
@vfr authored
Showing with 5 additions and 10 deletions.
  1. +2 −2 Reader.xcodeproj/project.pbxproj
  2. +3 −8 Sources/ReaderDocument.m
View
4 Reader.xcodeproj/project.pbxproj
@@ -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;
View
11 Sources/ReaderDocument.m
@@ -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.
@@ -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
}

6 comments on commit 3548ea1

@Rajios

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

@Beulenyoshi

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

@engkhaled

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

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

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

Thanks you.

@obaidjawad

@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.
Something went wrong with that request. Please try again.