react-native-pdf-lib
react-native-pdf-lib copied to clipboard
IOS - React Native auto link Fix
Fix IOS, auto import files.
P.S: Probably not the best way to import, but i couldn't find a way to import the folders too.
This fixed the issue with the import for me, but I get an EXC_BAD_ACCESS when trying to create a PDF on iOS.
Just a note that the reason this isn't merged yet is:
- @EricWiener hit an issue
- I don't have time to test this at the moment.
I'd be happy to merge a RN 60+ auto link support PR, just need to be confident that it works, and make sure that it's tested well. If someone else is happy to chip in help here, more than happy to merge and release.
This fixed the issue with the import for me, but I get an EXC_BAD_ACCESS when trying to create a PDF on iOS.
I got the same EXC_BAD_ACCESS error when made the changes in PR#80. Turned out drawText function is using a default font (Times New Roman) which is not supported in my iOS project. Just had to set fontName
option to one of the fonts that are supported.
@calinbodnar sounds like we should set the default font to a font that's always available in iOS to make this easier for people.
This PR worked for me (finally) in react-native 0.71, after trying many other PRs and code changes. I had to copy the RNReactNativePdfLib.podspec from the ios folder to the root of the library (node_modules/react-native-pdf-lib) and then add "ios/" to the paths referenced within that file, and also remove the ".." in front of "../package.json".
This PR worked for me (finally) in react-native 0.71, after trying many other PRs and code changes. I had to copy the RNReactNativePdfLib.podspec from the ios folder to the root of the library (node_modules/react-native-pdf-lib) and then add "ios/" to the paths referenced within that file, and also remove the ".." in front of "../package.json".
Hey @rcaseSW , can you please help me out for this issue ? Have you linked manually.....i get error if i link manually: ''React/RCTConvert.h' file not found'. please explain me this "add "ios/" to the paths referenced within that file".
@shivanip-iprogrammer I did not link manually. I just moved the RNReactNativePdfLib.podspec file to the root of the library, then adjusted the paths within that file so they pointed to the files correctly from the root. So I modified the package.json line as mentioned above, and also modified the following lines as such, adding "ios/" to the paths:
s.source_files = "ios/.{h,mm}", "ios/lib/**/" s.ios.vendored_libraries = ["ios/lib/universal/libFreeType.a", "ios/lib/universal/libLibJpeg.a", "ios/lib/universal/libLibTiff.a", "ios/lib/universal/libPDFWriter.a", "ios/lib/universal/libZlib.a"]
Note that I later found out this solution only works for developing on mac's with an intel processor (x86). It does not build on M1 or M2 macs (arm64 architecture).
@rcaseSW Thanks for solution but it is not working at my end and i have a mac with intel processor. I get this issue - **
TypeError: Cannot read property 'createPDF' of null
It seems this is the issue of linking but unfortunately link does not work after RN>=69.