GitHub 저장소abom-me/custom_save_pdf

사용자 지정 PDF 저장

Flutter 패키지는 휴대폰 저장소의 사용자 정의 폴더에 PDF 파일을 저장할 수 있도록 해줍니다.

사용자 지정 PDF 저장 프로젝트 이미지
스타
0
포크
0
최근 푸시(UTC)
2023. 1. 5.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

custom_save_pdf:

Flutter Package allowed you to saving pdf files in custom folder in phone storage

Change To عربي Version

# 👨‍💻 Developed by:

profile

Nasr Al-Rahbi @abom_me

👨🏻‍💻 Find me in :

Twitter Instagram LinkedIn Stack Overflow



custom_save_pdf: using the official open_document & path_provider & permission_handler.

⚠️ The Requirement ⚠️ :
Android iOS
Support SDK 29+ iOS 11+

Setup:

Pubspec changes:

      dependencies:
        custom_save_pdf: <last_verison>

Sample example:

import 'package:custom_save_pdf/custom_save_pdf.dart';

CustomPdfFolder.save(
byteList: data,
nameOfFolder: 'nasr',
openPDF: true,
onSaved: (v) {},
onError: (error, code) {
print(error);
print(code);
});

Getting Started

  • You Should Follow all the instructions carefully
-----Android-----------
  1. You should make sure to set the correct minSdkVersion in android/app/build.gradle :
android {
    defaultConfig {
        minSdkVersion 29
    }
}

2-You should make sure to set the correct compileSdkVersion in android/app/build.gradle :

android {
    compileSdkVersion 33
    ...
}

3-Add this in android/app/build.gradle :


<!-- First add this  -->
 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />


<application
        <!-- now add this line in application   -->
android:requestLegacyExternalStorage="true"
...
        >

        <!--  add this code inside  tag application   -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="{the pakage of app}.{the app name}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/provider_paths" />
</provider>

3- Go to android/app/src/main/res and create folder name it xml then create provider_paths.xml


<!-- Add this code in provider_paths.xml  -->
<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path
            name="external_files"
            path="." />
</paths>



-----IOS-----------
Note:
In IOS your folder will be created in the app folder
Example In File App : App_name/your_folder/your_pdf

1- add this code in info.plist:

 <key>LSSupportsOpeningDocumentsInPlace</key>
    <true/>
-------------------------------------------------

See the example directory for a complete sample app.

Parameters of the CustomPdfFolder
 /// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- EN ----</p>
/// ###  Add The Uint8List From (PDF) Package
/// #### <a href="https://pub.dev/packages/pdf"> PDF Package </a>
/// #### <span style="color:green">  You Will find example in the document</span>

/// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- AR ----</p>
/// ### اضف كود
/// ### Uint8List
///### بإمكانك الحصول عليه من باكج
///### PDF
/// ### <a href="https://pub.dev/packages/pdf"> PDF Package </a>
/// #### <span style="color:green">  سوف تجد أمثلة في مستندات الباكج</span>

final Uint8List byteList;

/// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- EN ----</p>
///
/// ### Write  Name for The folder, Where The PDF File Saving on it
///

/// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- AR ----</p>

/// ### أكتب أسم المجلد الذي تريد حفظ الملفات بداخله
final String nameOfFolder;

/// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- EN ----</p>
/// ### Write  name for the file, for example:

/// #### (-- example.pdf --)
/// <span style="color:#d80000"> Without (.pdf) </span>
/// <br>
/// <span style="color:green">You can keep it empty and will make random name</span>
/// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- AR ----</p>
/// ### أكتب اسم للملف الذي تريد حفظه, مثال:
/// #### (-- example.pdf --)

/// <span style="color:#d80000"> بدون اضافة الامتداد (.pdf) </span>
/// <br>
/// <span style="color:green">بإمكانك تركه فارغا وسوف يقوم بإنشاء اسم عشوائي </span>

final String? fileName;

/// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- EN ----</p>
/// ### Here You can get the path of the pdf file as String

/// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- AR ----</p>
/// ### هنا يعطيك مسار الملف كنص

final void Function(String filePath)? onSaved;

/// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- EN ----</p>
/// ### Here showing you any error happen with the code of the error and you can add Function if there is any errors

/// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- AR ----</p>
/// ### هنا يظهر  نص و رقم الخطأ اذا حدثت اي اخطاء، و بإمكانك إعطائه امر ليفعله اذا عثر على خطأ

final void Function(String error, int errorCode)? onError;

/// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- EN ----</p>
/// ### keep it true to open the pdf file after save it
/// ### or false to only saving in files
/// <span style="color:green;font-size:13;font-weight: bold;">it's True by default  </span>

/// <p style="color:#77b4ff;font-size:16;font-weight: bold;">---- AR ----</p>
/// #### True
/// #### لكي ينفتح الملف بعد حفظه
/// #### False
/// #### لكي يحفظ الملف فقط بدون فتحه
bool? openPDF = true;

Nasr Al-Rahbi GitHub avatar
GitHub 작성자

Nasr Al-Rahbi ↗

Full-Stack Developer- Flutter, Firebase,PHP And Mysql

Oman
언어DartRubySwiftKotlinObjective-C

분류

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 7 개

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗