braintree使用_使用Braintree v.zero SDK购买时间

article/2025/8/22 5:39:51

braintree使用

This article was sponsored by Braintree. Thank you for supporting the sponsors who make SitePoint possible!

本文由Braintree赞助。 感谢您支持使SitePoint成为可能的赞助商!

Braintree touts itself as offering “Simple, powerful payments.” We’ve been using Braintree at my company, KYCK, for ages now and I can attest how easy it makes accepting payments. In December of 2013, Braintree was acquired by PayPal. Not much changed due to the acquisition until recently. As the first major change, Braintree has released a new client SDK aimed at making things easier and adding some new features.

Braintree自称为提供“简单,强大的付款”。 多年来,我们一直在我的公司KYCK使用Braintree,我可以证明它使接受付款变得多么容易。 2013年12月,Braintree被PayPal收购。 直到最近由于收购而变化不大。 作为第一个重大更改,Braintree发布了一个新的客户端SDK,旨在使事情变得更轻松并添加一些新功能。

The new SDK is called “v.zero,” and it offers:

新的SDK称为“ v.zero”,它提供:

  • A new Drop-In UI that allows you to start accepting payments with “as little as ten lines of code.”

    新的Drop-In UI,使您可以开始使用“仅十行代码”就可以接受付款。
  • The ability to easily accept PayPal as a payment method. This is the big, new feature of the SDK, and, no doubt, a direct result of the PayPal acquisition.

    轻松接受PayPal作为付款方式的能力。 这是SDK的一大新功能,毫无疑问,这是收购PayPal的直接结果。
  • Soon, the ability to accept payments via Bitcoin, through a partnership with Coinbase.

    很快, 通过与Coinbase的合作伙伴关系,可以通过比特币接受付款 。

  • Powerful, customizable payment flow to fit your needs when the Drop-In UI doesn’t work.

    当Drop-In UI不起作用时,强大的可自定义付款流程可满足您的需求。
  • Future changes to the SDK that will be “easy.” In other words, Braintree aims to keep the SDK current with constantly changing technology without forcing developers to overhaul their payment flow.

    对SDK的将来更改将“轻松”进行。 换句话说,布伦特里(Braintree)旨在通过不断变化的技术使SDK保持最新状态,而不会强迫开发人员检查其支付流程。
  • One Touch™ mobile payments with PayPal and Venmo. One Touch makes accepting payments via your mobile app as seamless as possible. This article announcing One Touch has a great video explaining the service. If you are a mobile developer, this is a big deal.

    使用PayPal和Venmo的One Touch™移动支付。 一键式通过您的移动应用程序尽可能无缝地接受付款。 宣布One Touch的这篇文章有一段精彩的视频介绍了该服务。 如果您是移动开发人员,那么这很重要。

In this post, I’ll walk through some of the features of the v.zero SDK. Most of the focus will be on the Drop-In UI and accepting PayPal, so you can get up and running fast.

在本文中,我将逐步介绍v.zero SDK的一些功能。 大多数重点将放在Drop-In UI和接受PayPal上,因此您可以快速启动并运行。

应用程序 (The Application)

In order to accept payments, there has to be a product. For our app, I want a compelling product. Something that everyone wants or needs, something that they’ll flock to the site to buy. It hit me like a lightning bolt in the middle of the night: Time. Everyone wants more time. So, that’s what we’re going to sell. Our users will be able to buy extra hours to spend as they see fit in their busy lives. We are going to be bazillionaires in no time.

为了接受付款,必须有一种产品。 对于我们的应用程序,我想要一个引人注目的产品。 每个人都想要或需要的东西,他们会涌向该网站购买的东西。 它像半夜的闪电般击中了我:时间。 每个人都想要更多的时间。 因此,这就是我们要出售的东西。 我们的用户将可以购买额外的时间来度过忙碌的生活。 我们将很快成为亿万富翁。

The app is a vanilla Rails app with Devise for authentication. I am not going to walk through setting up the Rails app. Instead, our starting point is a Rails app with a User model that uses Devise’s password authentication. I’ve also added Zurb Foundation for some easy styling. There are roughly 1.2 million tutorials on how to setup Rails and Devise, and I have tagged our starting point (“starting_point”) in the repository.

该应用程序是带有Devise进行身份验证的香草Rails应用程序。 我不会逐步设置Rails应用程序。 取而代之的是,我们的起点是一个具有使用Devise密码验证的用户模型的Rails应用。 我还添加了Zurb Foundation,以简化样式。 关于如何设置 Rails和Devise的教程大约有120万本,我已经在存储库中标记了我们的起点(“ starting_point”)。

Our users will have a very simple purchasing flow. Once logged in, the user can choose a payment method (credit card or PayPal) and pay $10 for 1 hour. To start, the application has an OrdersController with a new action and view.

我们的用户将拥有非常简单的购买流程。 登录后,用户可以选择一种付款方式(信用卡或PayPal),并在1小时内支付10美元。 首先,应用程序具有一个带有new动作和视图的OrdersController

SDK的工作方式 (How the SDK Works)

The Braintree payment flow consists of four steps:

Braintree付款流程包括四个步骤:

  • Create a Braintree Account.

    创建一个Braintree帐户。
  • Add the Braintree Ruby Library to the application.

    将Braintree Ruby库添加到应用程序。
  • Provide a client token to your client (meaning, the browser, in our case)

    向客户提供客户令牌(在我们的情况下,即浏览器)
  • Receive a payment method nonce from the client (browser) after a payment is authorized (Note: Before this step, if you had asked me what a nonce is, I would’ve said, “an often rabid, small, furry animal that attacks without provocation.” There’s a lot I don’t know.)

    在授权付款后,从客户(浏览器)那里收到一种付款方式的随机数(注意:在此步骤之前,如果您问我随机数是什么,我会说:“一种经常狂犬病的小毛茸茸动物没有挑衅。”我不知道很多。
  • Create a transaction on Braintree using the payment method nonce.

    使用付款方式现时在Braintree上创建交易。

创建一个Braintree帐户 (Create a Braintree Account)

In order to use Braintree to accept payments, you have to sign up for a Braintree account. It’s recommended to start in the Braintree “Sandbox,” which allows you to test payments without money actually exchanging hands. The Sandbox is a godsend, allowing developers to perfect the payment flow in an environment that mirrors the real thing.

为了使用Braintree接受付款,您必须注册一个Braintree帐户。 建议从Braintree“沙盒”开始,它可以让您测试付款而无需实际换手。 沙盒是天赐的礼物,它使开发人员能够在反映真实事物的环境中完善支付流程。

Head over to the Get Started page and sign up for an account.

转到“ 入门”页面并注册一个帐户。

Sign Up Form

Braintree will send a confirmation email, so get confirmed and we’re ready to move forward.

Braintree将发送一封确认电子邮件,因此得到确认,我们准备前进。

The first login drops you on the Sandbox Dashboard, which looks like this:

首次登录将您带到Sandbox仪表板上,如下所示:

Sandbox Dashboard

The important bits on this page are: Merchant ID:, Public Key, and Private Key. These values will be used to configure the Braintree SDKs in our Rails app. In fact, if you look on that same page, there is an example Ruby configuration that can be copied and pasted into your app.

此页面上的重要位是: 商户ID :,公钥私钥 。 这些值将用于在Rails应用程序中配置Braintree SDK。 实际上,如果您在同一页面上查看,就会有一个示例Ruby配置,可以将其复制并粘贴到您的应用程序中。

获取Braintree Ruby库 (Get the Braintree Ruby Library)

Example Ruby Configuration

In Rails, this kind of configuration is handled in an initializer. However, we don’t have a Braintree class in our codebase yet. Luckily, Braintree has a Rubygem for us to utilize. Add gem "braintree" to the Gemfile and bundle install.

在Rails中,这种配置在初始化程序中处理。 但是,我们的代码库中还没有Braintree类。 幸运的是,布伦特里有一个Rubygem供我们使用。 将gem "braintree"添加到Gemfilebundle install

Create a config/initializers/braintree.rb with the following:

使用以下命令创建config / initializers / braintree.rb

Braintree::Configuration.environment  = ENV['BRAINTREE_ENV']         || :sandbox
Braintree::Configuratio.merchant_id   = ENV['BRAINTREE_MERCHANT_ID'] || 'your merchant id'
Braintree::Configuration.public_key   = ENV['BRAINTREE_PUBLIC_KEY']  || 'your public key'
Braintree::Configuration.private_key  = ENV['BRAINTREE_PRIVATE_KEY'] || 'your private key'

生成客户令牌 (Generate a Client Token)

When our users show up to buy more time, Braintree has to know who we are in order to get us our millions. Basically, the users will select a payment method and authorize a payment by submitting a form from our app to Braintree’s servers. The client token will be provided alongside the user’s information, and it tells Braintree who we are by identifying our merchant account on their side. Braintree returns a payment method nonce that represents the authorized payment to our application, which we’ll discuss in a moment.

当我们的用户出现来购买更多时间时,Braintree必须知道我们是谁,才能为我们赢得数百万美元。 基本上,用户将选择付款方式并通过将应用程序中的表格提交给Braintree的服务器来授权付款。 客户令牌将与用户信息一起提供,并通过识别我们在他们那边的商家帐户来告诉Braintree我们是谁。 Braintree向我们的应用程序返回了代表授权付款的付款方式随机数,我们将在稍后讨论。

嵌入式UI (Drop-In UI)

Here is where the new Drop-In UI in the v.zero SDK comes into play. Create a partial called app/views/payment/_form.html.erb:

这是v.zero SDK中新的Drop-In UI起作用的地方。 创建一个名为app / views / payment / _form.html.erb的部分文件

<form id="checkout" method="post" action="/checkout">
<div id="dropin"></div>
<input type="submit" value="Pay $10">
</form>
<script type="text/javascript">
function setupBT() {
braintree.setup("<%=@client_token%>", 'dropin', {
container: 'dropin'
});
}
if (window.addEventListener)
window.addEventListener("load", setupBT, false);
else if (window.attachEvent)
window.attachEvent("onload", setupBT);
else window.onload = setupBT;
</script>
</script>

This form is pulled directly from the Braintree docs. The script block is added here to handle the generation of the client token. I wanted to keep it all in one file to make it clearer for this tutorial. The token is created in the OrdersController#new method:

form直接从Braintree文档中提取。 此处添加了script块来处理客户端令牌的生成。 我想将所有内容保存在一个文件中,以使本教程更加清楚。 令牌是在OrdersController#new方法中创建的:

def new
@client_token = Braintree::ClientToken.generate
end

Those same Braintree docs show the need to add the Braintree javascript file, so let’s do that now. Download the braintree.js file into the vendor/assets/javascripts directory and add it to our app/assets/javascripts/applications.js:

这些相同的Braintree文档表明需要添加Braintree javascript文件,所以现在就开始做。 将braintree.js文件下载到vendor / assets / javascripts目录中,并将其添加到我们的app / assets / javascripts / applications.js中

//= require braintree (ADD THIS LINE)
//= require_tree . (This line already exists)

Now, the braintree javascript variable in our setupBT function will exist.

现在, setupBT函数中的braintree javascript变量将存在。

If you run the server (and sign up for an account in the app), the Drop-In UI renders and looks pretty good:

如果您运行服务器(并在应用程序中注册帐户),则Drop-In UI会呈现并看起来非常不错:

Drop-In UI

It looks like we have the ability to accept PayPal and credit cards out of the box. But that form looks a bit odd without a CVV field. How can we add CVV?

看来我们有能力开箱即用地接受PayPal和信用卡。 但是,如果没有CVV字段,则该表格看起来有些奇怪。 我们如何添加CVV?

We can add CVV to our form by configuring it in the Braintree Sandbox. Once logged in, Choose “Processing” from the “Settings” menu:

我们可以通过在Braintree沙箱中配置CVV到表单中。 登录后,从“设置”菜单中选择“处理中”:

Settings Menu

This page has a metric ton of configuration options, including:

此页面具有大量的配置选项,包括:

  • Duplicate Transaction Checking, which stops a transaction from being created if it matches one within the last 30 seconds.

    重复事务检查,如果在最近30秒内匹配一个事务,则将阻止创建该事务。
  • Accept Venmo.

    接受Venmo 。

  • Basic Fraud Protection, including CVV.

    基本欺诈保护,包括CVV。
  • Custom Fields.

    自定义字段。
  • Email Receipts.

    电子邮件收据。
  • Much, much more.

    更多,更多。

To get CVV added to the form, we’ll need to configure the rules. Click the “Edit” button under “CVV” and add your rules. Here’s mine:

要将CVV添加到表单中,我们需要配置规则。 单击“ CVV”下的“编辑”按钮,然后添加您的规则。 这是我的:

CVV Rules

With the CVV rules configured, the form now has the CVV field:

配置了CVV规则后,表单现在具有CVV字段:

CVV Form

That is pretty cool.

太酷了。

付款方式 (Payment Method Nonce)

On to the last step in our basic process: getting a payment method nonce from Braintree that we will provide to our Rails server and then back to Braintree to add a payment.

进入基本流程的最后一步:从Braintree获取付款方式随机数,我们将其提供给Rails服务器,然后返回Braintree添加付款。

I want this to be as simple as possible for our first payment. As such, we’ll change the action on our form to post to /orders and we’ll render out the @params. Change the form partial:

我希望我们的第一笔付款尽可能简单。 这样,我们将更改表单上的action以将其发布到/orders并渲染@params 。 更改部分表格:

<%= form_tag orders_path, method: "post" do %>
<div id="dropin"></div>
<input type="submit" value="Pay $10">
<% end %>
<%= @params %> <!-- We'll remove this later, just testing now -->

The form is now Rails-ed up a bit, that way there won’t be any authenticity token errors. Also, I added @params so we can get a good look at what is provided to the server by the Braintree form.

现在,该表单已被Rails修改,这样就不会出现任何真实性令牌错误。 另外,我添加了@params以便我们可以更好地了解Braintree表单提供给服务器的内容。

POSTing to /orders is going to expect OrdersController#create to exist. Starting simple:

发布到/orders将期望OrdersController#create存在。 从简单开始:

def create
@params = params
render action: :new
end

To test the form with a credit card, we need a fake number. You can grab fake credit card numbers from this page on the PayPal site. (They don’t work for real stuff… not that I tried them or anything.)

要使用信用卡测试表格,我们需要一个假号码。 您可以从PayPal网站上的此页面上获取伪造的信用卡号。 (它们不适用于真正的东西……不是我尝试过它们或其他方法。)

Fill out the form and see what happens.

填写表格,看看会发生什么。

Form Filled Out

I immediately noticed the following coolness:

我立即注意到以下凉爽之处:

  • It won’t let me type any garbage into the Credit Card or other fields. Some basic, but solid, input validation comes with the form for free. Nice.

    它不会让我在“信用卡”或其他字段中输入任何垃圾内容。 该表格免费提供一些基本但可靠的输入验证。 真好
  • The text labels are helpful and intuitive. It’s a nice experience, in fact, and better than a form that took KYCK ages to design and implement.

    文本标签非常有用且直观。 实际上,这是一种很好的体验,并且比花了KYCK多年的时间设计和实施的形式要好。

Submitting the form posted to our create method and rendered the params in the view:

将表单提交到我们的create方法,并在视图中呈现参数:

{"utf8"=>"✓",
"authenticity_token"=>"Yxt5NzsrKB4u/rEjmR3A7pIwVbcpGCL/lEBTMx7H8x0=",
"payment_method_nonce"=>"1e6dfd62-f92e-4703-8807-b3f6b9b28c84",
"action"=>"create",
"controller"=>"orders"}

There it is… the payment method nonce. You can read about nonces all you want, but seeing one in the wild is truly a breathtaking experience.

那里...付款方式随机数。 您可以随意阅读有关随机数的信息,但是在野外看到一个随机数确实是一种令人叹为观止的体验。

创建Braintree交易 (Create a Braintree Transaction)

Well, this is pretty exciting. We are already on to the last step in our test run of accepting payments. At this point, it’s simply a matter of creating a transaction on Braintree. This is pretty easy, as it turns out. Change OrdersController#create like so:

好吧,这非常令人兴奋。 我们已经进入接受付款测试的最后一步。 此时,只需在Braintree上创建事务即可。 事实证明,这很容易。 像这样更改OrdersController#create

def create
nonce = params[:payment_method_nonce]
render action: :new and return unless nonce
result = Braintree::Transaction.sale(
amount: "10.00",
payment_method_nonce: nonce
)
flash[:notice] = "Sale successful. Head to Sizzler" if result.success?
flash[:alert] = "Something is amiss. #{result.transaction.processor_response_text}" unless result.success?
redirect_to action: :new
end

Go back and fill in your form with that fake credit card number and BOOM! We can accept payments.

返回并使用该假信用卡号和BOOM填写您的表格! 我们可以接受付款。

Sizzler

输入贝宝 (Enter PayPal)

Let’s see if the using PayPal is as easy as using a fake credit card number. Go back to the app and, instead of filling out the form, click that big, blue PayPal button. You should see a popup asking you to sign in:

让我们看看使用PayPal是否像使用伪造的信用卡号一样容易。 返回应用程序,而不是填写表单,而是单击蓝色的大贝宝按钮。 您应该会看到一个弹出窗口,要求您登录:

PayPal Login

Notice it places an overlay on the main form, which is sassy. Once logged in, you’re told exactly what the vendor is asking:

请注意,它在主要表单上放置了一个时髦的叠加层。 登录后,将确切告知您供应商的要求:

Terms

Click ‘Agree’, and you’re returned to the form. It changes to reflect that you’re using PayPal

点击“同意”,您将返回到表单。 它发生变化以反映您正在使用PayPal

Using PayPal

Click “Pay $10” and watch PayPal being accepted. MMMM…that is some good payment.

单击“支付10美元”,然后查看接受PayPal。 MMMM ...这是一个不错的付款。

数钱 (Counting Our Money)

If you head over to the Braintree Sandbox dashboard, you can see that we are movin’ on up!

如果您转到Braintree Sandbox仪表板,您可以看到我们正在继续前进!

Money!

Man, today was HUGE for us!

伙计,今天对我们来说是巨大的!

下一步 (Next Steps)

This article scratches the surface of what can be done with the Braintree v.zero SDK. If we wanted to take our time-buying application to the next level, we might:

本文介绍了Braintree v.zero SDK可以完成的工作。 如果我们想将按时间购买的应用程序提高到一个新的水平,我们可以:

  • Store Braintree customer IDs on our local Users, allowing these users to reuse payment methods. Braintree offers the Vault that will store tokens for each of the payment methods a user adds. The customer can then choose one of these payment methods when returning to buy more time.

    将Braintree客户ID存储在我们的本地用户上,以允许这些用户重复使用付款方式。 Braintree提供的保管箱将存储用户添加的每种付款方式的令牌。 然后,客户在返回购买更多时间时可以选择这些付款方式之一。

  • Control the transaction life cycle for our application’s transactions. The Braintree transaction processing flow is involved and you need to know it if you’re using Braintree. You can settle, release, refund funds, among other actions. Learn it, live it, love it.

    控制应用程序交易的交易生命周期。 涉及Braintree事务处理流程 ,如果您正在使用Braintree,则需要知道它。 您可以清算,释放,退款资金以及其他操作。 学习,生活,热爱它。

  • Offer subscriptions to our customers. Maybe they can get 10 hours a month for $90 or something. Braintree offers recurring billing that is surprisingly easy to handle. This is where the real cheese lives.

    向我们的客户提供订阅。 也许他们每月可以花90美元左右的价格获得10个小时的服务。 Braintree提供的定期计费出奇地易于处理。 这就是真正的奶酪所在的地方。

Maybe you have other suggestions for where we can take our time hawking? Let me know what we should do next, and maybe I’ll pen an article for the most requested item.

也许您对我们可以在哪里花时间做其他建议? 让我知道下一步该怎么做,也许我会为最需要的项目写一篇文章。

Remember, the source for this article is in this repository.

请记住,本文的来源在此存储库中 。

In the meantime, watch out for those nonces. They can spring at any time.

同时,提防那些随机性。 他们可以随时弹跳。

翻译自: https://www.sitepoint.com/buy-time-braintree-v-zero-sdk/

braintree使用


http://chatgpt.dhexx.cn/article/lg1vhs5P.shtml

相关文章

简单聊聊PayPal与BrainTree选型经历

2019年9月30日&#xff0c;PayPal公司被批准通过对国付宝的股权收购正式进入中国。2019年12月19日晚间&#xff0c;PayPal公司正式宣布&#xff0c;已完成对国付宝信息科技有限公司&#xff08;Gopay&#xff09;70%的股权收购。交易完成后&#xff0c;PayPal成为第一家获准在中…

Braintree PayPal 支付网关开发(二)

开发准备在上篇文章已经介绍 >>看这里 << 这篇文章说下Demo示例。 1. 开发流程图这里再贴一下&#xff08;很重要&#xff09;&#xff1a; 2. 前端页面 2.1 代码 <div class"wrapper"><div class"checkout container"><…

braintree_Braintree的透明重定向

braintree The mere mention of “PCI Compliance” usually elicits a combination of confused looks and sweaty palms from business owners who accept credit card payments online. But what does it really mean? 仅仅提到“ PCI Compliance”通常会引起混淆的外观和来…

uniapp app端 对接 braintree

背景 项目客户端是uniapp&#xff08;app端&#xff09;&#xff0c;用户是海外微信支付宝肯定不行了&#xff0c;安卓苹果端都要&#xff0c;可选的支付方式有&#xff1a;1、苹果支付谷歌支付。2、paypal。3、Stripe 我比较看好paypal&#xff0c;最后领导决定用braintree。…

braintree支付开发整合paypal

braintree支付开发 braintree介绍 流程介绍 前端从服务端请求一个客户端令牌&#xff0c;并初始化客户端SDK。 服务端SDK生成客户端令牌并将其发送回客户端 客户提交付款信息&#xff0c;客户端SDK将该信息传递给Braintree&#xff0c;并返回付款方式随机数 前端付款方式随…

uniapp|vue 中的 braintree 支付

参考文档&#xff1a; Braintree-国外支付对接&#xff08;一&#xff09; Braintree-国外支付对接&#xff08;二&#xff09; Braintree-国外支付对接&#xff08;三&#xff09; 前面的两篇文章&#xff0c;有详细介绍了 Braintress 的账号创建&#xff1b;以及 SandBox 测…

Braintree PayPal 支付网关开发(一)

一般网上消费流程&#xff1a; 消费者 > 商户网站 > 消费者账户银行 > 支付网关 > 支付处理系统 > 商户收款银行 Braintree 就是一种支付方式。 Braintree 支付网关开发的准备&#xff1a; Braintree 支付网关开发流程&#xff1a; 第1步&#xff1a;前端请求自…

Braintree-国外支付对接(二)

在前文 国外支付对接&#xff1a;Braintree&#xff08;一&#xff09;的基础上 已经拿到了相关配置信息&#xff0c;接下来就是码代码了&#xff0c;这里完成的主要功能是支付与退款。 在此之前&#xff0c;先说一下Briantree的支付流程&#xff1a; 第一步先生成clientToke…

app接入 Paypal BrainTree

BrainTree 是什么 braintree 一开始是一个独立支付网关&#xff08;gateway&#xff09;&#xff0c;后来在2013年左右&#xff08;没记错的话&#xff09;被 Paypal收购。收购之后基本可以看作与paypal是一家。 paypal 收购 braintree 之后 sdk 也转向重点接入 braintree&…

多种方式99.9%解决从PDF复制文字后乱码问题

背景 需要从PDF复制文字出来做笔记&#xff0c;可是谁知道PDF通过adobe打开后复制出来后是乱码&#xff0c;如下图所示&#xff1a; &#xff08;再次感谢guide哥整理的文档&#xff09; 解决 尝试过安装字体&#xff0c;可惜没卵用。 方法1-CAJViewer打开 用该软件打开后…

java word转pdf 在linux转pdf乱码解决方法

word转pdf word转pdf,完美转换 引入依赖 (maven仓库是没有的&#xff0c;需要在项目中引用) 链接: 下载地址. 然后在pom里面引入下面这段&#xff0c;依赖我们就搭建好了 <dependency><groupId>com.aspose</groupId><artifactId>aspose-words</a…

word转pdf公式乱码_MathType转换成pdf符号丢失或乱码怎么办

一般写论文的时候是在Word中编写&#xff0c;在Word中写公式时一般是使用MathType&#xff0c;MathType编辑出来的公式非常标准与美观&#xff0c;很多国际期刊杂志都有这种要求。但是在将编写好的论文进行投稿时需要将Word文档转换成PDF文档&#xff0c;这样论文公式才不会发生…

itextpdf生成pdf中文乱码 (乱码中挣扎的自述)

生成pdf文件的方法有很多&#xff0c;网上也有很多的介绍&#xff0c;本文主要主要是讲生成pdf乱码的问题&#xff0c;而且还十分诡异&#xff0c;具体生成pdf的步骤同学们可以自己百度&#xff0c;也可以参考如下链接&#xff1a; https://www.cnblogs.com/LUA123/p/5108007.…

pdf转换html乱码怎么办,pdf转word后乱码怎么办?

pdf转word后乱码怎么办&#xff1f;网络上面有一些PDF资料你可以对其内容复制&#xff0c;但是粘贴到word或者文本中就是一堆乱码&#xff0c;你用转换软件转换出来&#xff0c;有一些文件不会是乱码&#xff0c;但是还有一些文件依旧是乱码&#xff0c;怎么办呢&#xff1f;今…

表格生成pdf 中字乱码

表格生成pdf及解决中字乱码 npm库表格生成pdf的超简洁小例子(用的是npm导入字体)两种解决乱码方法直接引入npm引入在项目中导入stsong-font在所需的页面上引用最后在生成pdf函数中使用(同上) npm库 两个必备包 jspdf npm i jspdfjspdf-autotable npm i jspdf-autotable在所需…

php生成pdf乱码_ierport 生成pdf出现乱码问题

iReport导出pdf中文乱码问题解决 使用iReport的过程经常遇到一些乱码的问题&#xff0c;最近用iReport导出pdf的时候就遇到中文不能显示的问题。 要使导出的pdf能够显示中文&#xff0c;需要用到iTextAsian.jar包。 1.将显示中文的地方Text属性设置成支持中文的字体。 Pdf font…

PDF文件复制文本为乱码

PDF文件可能会出现复制文本粘贴成乱码的现象。原因是PDF中所用的字体无法在电脑中找到&#xff0c;点击编辑器的”文件-属性“&#xff0c;查看字体&#xff0c;如果字体可以下载&#xff0c;可以在网上下载安装&#xff0c;就可以进行复制粘贴。 但有的PDF为保护内容&#xff…

pdf复制乱码_网站推荐 | 从未见过你这么不单纯的PDF转换器!

点击蓝字 关注我们 之前给大家分享过几期PDF转换器 但是仍然觉得部分线上转换器会出现 格式乱码、甚至字乱码的现象 (字乱码是由于外文网址识别误差) 这次挥挥找到了一个PDF转word 近乎完美保留原格式的在线转换网站&#xff01; 一起来看看叭 Today PDF转换器 http://www.pdfd…

Pdf 解密后复制文字乱码

1、安装cajviewer 这个工具 2、用CAJviewer打开pdf文档 3、选择图像4、点文字识别&#xff0c;这时候就弹窗一个框&#xff0c;里面是可复制的文本&#xff0c;而且准确率比较高 转载于:https://www.cnblogs.com/wangyuelang0526/p/3735398.html

使用latex撰写中文科技论文时,生成的PDF复制中文时乱码(不能查重),解决办法如下

在投稿中文期刊《控制理论与应用》时&#xff0c;期刊要求必须用latex&#xff0c;官方给的编辑器是WinEdt7.0&#xff0c;但是如果用常用的编译方式生成PDF的话&#xff0c;也就是第一个选项PDFTeXify 打开生成的PDF表面上看是没有任何问题的&#xff0c;可以正常阅读。但是如…